Use null propagation

This commit is contained in:
Gustas
2023-02-19 15:29:08 +02:00
committed by Pavel Penev
parent b06cbd7a95
commit 157d1b32dc
12 changed files with 30 additions and 36 deletions

View File

@@ -100,9 +100,7 @@ namespace OpenRA.Graphics
static void LoadCollection(string name, MiniYaml yaml)
{
if (Game.ModData.LoadScreen != null)
Game.ModData.LoadScreen.Display();
Game.ModData.LoadScreen?.Display();
collections.Add(name, FieldLoader.Load<Collection>(yaml));
}

View File

@@ -111,8 +111,7 @@ namespace OpenRA.Graphics
var template = kv.Value;
for (var i = 0; i < template.Sprites.Length; i++)
{
if (template.Cursors[i] != null)
template.Cursors[i].Dispose();
template.Cursors[i]?.Dispose();
// Calculate the padding to position the frame within sequenceBounds
var paddingTL = -(template.Bounds.Location - template.Sprites[i].Offset.XY.ToInt2());