Merge pull request #8319 from Mailaender/hacky-currentstate-nre

Fixed possible NREs in AI.StateMachine
This commit is contained in:
Oliver Brakmann
2015-06-02 22:35:49 +02:00

View File

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