Fix DamageModifier crashes when an actor is demolished.

Demolish calls GetDamageModifier with a null Damage.
This commit is contained in:
Paul Chote
2019-08-26 10:04:53 +01:00
committed by reaperrr
parent 6b1e81a7b5
commit 61c56dcb00
2 changed files with 2 additions and 2 deletions

View File

@@ -92,7 +92,7 @@ namespace OpenRA.Mods.Common.Traits
if (!IsProne)
return 100;
if (damage.DamageTypes.IsEmpty)
if (damage == null || damage.DamageTypes.IsEmpty)
return 100;
var modifierPercentages = info.DamageModifiers.Where(x => damage.DamageTypes.Contains(x.Key)).Select(x => x.Value);

View File

@@ -42,7 +42,7 @@ namespace OpenRA.Mods.Common.Traits
int IDamageModifier.GetDamageModifier(Actor attacker, Damage damage)
{
if (attacker.Owner.IsAlliedWith(self.Owner) && damage.Value < 0 && !Info.ModifyHealing)
if (!Info.ModifyHealing && attacker.Owner.IsAlliedWith(self.Owner) && damage != null && damage.Value < 0)
return FullDamage;
var world = self.World;