Use Null-Propagation Operator
This commit is contained in:
@@ -36,11 +36,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (IsTraitDisabled || other.IsDead)
|
||||
return;
|
||||
|
||||
var external = other.TraitsImplementing<ExternalCondition>()
|
||||
.FirstOrDefault(t => t.Info.Condition == Info.Condition && t.CanGrantCondition(other, self));
|
||||
|
||||
if (external != null)
|
||||
external.GrantCondition(other, self, Info.Duration);
|
||||
other.TraitsImplementing<ExternalCondition>()
|
||||
.FirstOrDefault(t => t.Info.Condition == Info.Condition && t.CanGrantCondition(other, self))
|
||||
?.GrantCondition(other, self, Info.Duration);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user