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

@@ -53,9 +53,9 @@ namespace OpenRA.Mods.Common
public void Initialize(int value)
{
var field = GetType().GetField(nameof(value), BindingFlags.NonPublic | BindingFlags.Instance);
if (field != null)
field.SetValue(this, value);
GetType()
.GetField(nameof(value), BindingFlags.NonPublic | BindingFlags.Instance)
?.SetValue(this, value);
}
public override MiniYaml Save()