fix dereference after null check

This commit is contained in:
Matthias Mailänder
2015-08-29 08:05:00 +02:00
parent fda39f7136
commit 45f7526967

View File

@@ -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);
});