fix dereference after null check
This commit is contained in:
@@ -76,9 +76,14 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
var isb = self.HasTrait<ISpriteBody>();
|
var isb = self.HasTrait<ISpriteBody>();
|
||||||
|
|
||||||
// If a sprite actor has neither custom QuantizedFacings nor a trait implementing IQuantizeBodyOrientationInfo, throw
|
// If a sprite actor has neither custom QuantizedFacings nor a trait implementing IQuantizeBodyOrientationInfo, throw
|
||||||
if (qboi == null && isb)
|
if (qboi == null)
|
||||||
throw new InvalidOperationException("Actor" + self.Info.Name + "has a sprite body but no facing quantization."
|
{
|
||||||
+ " Either add the QuantizeFacingsFromSequence trait or set custom QuantizedFacings on BodyOrientation.");
|
if (isb)
|
||||||
|
throw new InvalidOperationException("Actor" + self.Info.Name + "has a sprite body but no facing quantization."
|
||||||
|
+ " Either add the QuantizeFacingsFromSequence trait or set custom QuantizedFacings on BodyOrientation.");
|
||||||
|
else
|
||||||
|
throw new InvalidOperationException("Actor type '" + self.Info.Name + "' does not define a quantized body orientation.");
|
||||||
|
}
|
||||||
|
|
||||||
return qboi.QuantizedBodyFacings(self.Info, self.World.Map.SequenceProvider, faction);
|
return qboi.QuantizedBodyFacings(self.Info, self.World.Map.SequenceProvider, faction);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user