fix dereference after null check
This commit is contained in:
@@ -76,9 +76,14 @@ namespace OpenRA.Mods.Common.Traits
|
||||
var isb = self.HasTrait<ISpriteBody>();
|
||||
|
||||
// If a sprite actor has neither custom QuantizedFacings nor a trait implementing IQuantizeBodyOrientationInfo, throw
|
||||
if (qboi == null && 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.");
|
||||
if (qboi == null)
|
||||
{
|
||||
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);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user