From 45f75269675b848e3022742f005eb79ed9442fe6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sat, 29 Aug 2015 08:05:00 +0200 Subject: [PATCH] fix dereference after null check --- OpenRA.Mods.Common/Traits/BodyOrientation.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/BodyOrientation.cs b/OpenRA.Mods.Common/Traits/BodyOrientation.cs index 86c1339a35..c15462f434 100644 --- a/OpenRA.Mods.Common/Traits/BodyOrientation.cs +++ b/OpenRA.Mods.Common/Traits/BodyOrientation.cs @@ -76,9 +76,14 @@ namespace OpenRA.Mods.Common.Traits var isb = self.HasTrait(); // 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); });