From eaa453335563d670d856da44bf4ea1f332c618a7 Mon Sep 17 00:00:00 2001 From: rhyskidd Date: Wed, 30 May 2012 13:26:32 +0000 Subject: Ensure check for NULL pointer occurs prior to use, not after --- Stars45/TacticalAI.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Stars45/TacticalAI.cpp') diff --git a/Stars45/TacticalAI.cpp b/Stars45/TacticalAI.cpp index e8bc09b..32d364a 100644 --- a/Stars45/TacticalAI.cpp +++ b/Stars45/TacticalAI.cpp @@ -1,6 +1,6 @@ /* Project Starshatter 4.5 Destroyer Studios LLC - Copyright © 1997-2004. All Rights Reserved. + Copyright (C) 1997-2004. All Rights Reserved. SUBSYSTEM: Stars.exe FILE: TacticalAI.cpp @@ -194,7 +194,8 @@ TacticalAI::CheckObjectives() bool TacticalAI::ProcessOrders() { - ship_ai->ClearPatrol(); + if (ship_ai) + ship_ai->ClearPatrol(); if (orders && orders->EMCON() > 0) { int desired_emcon = orders->EMCON(); -- cgit v1.1