From cd5c0eca79b2f49036ec907f561bab8a4513232f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sun, 31 May 2015 15:55:28 +0200 Subject: [PATCH] fix possible null reference exceptions --- OpenRA.Mods.Common/AI/StateMachine.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.Common/AI/StateMachine.cs b/OpenRA.Mods.Common/AI/StateMachine.cs index 8748f5ebba..96897e0b8c 100644 --- a/OpenRA.Mods.Common/AI/StateMachine.cs +++ b/OpenRA.Mods.Common/AI/StateMachine.cs @@ -17,7 +17,8 @@ namespace OpenRA.Mods.Common.AI public void Update(Squad squad) { - currentState.Tick(squad); + if (currentState != null) + currentState.Tick(squad); } public void ChangeState(Squad squad, IState newState, bool rememberPrevious) @@ -31,7 +32,8 @@ namespace OpenRA.Mods.Common.AI if (newState != null) currentState = newState; - currentState.Activate(squad); + if (currentState != null) + currentState.Activate(squad); } public void RevertToPreviousState(Squad squad, bool saveCurrentState)