hedgewars/uAI.pas
branchqmlfrontend
changeset 11549 b69f5f22a3ba
parent 11543 00860966354d
child 11613 ed70d59479d7
--- a/hedgewars/uAI.pas	Fri Jan 01 19:15:32 2016 +0300
+++ b/hedgewars/uAI.pas	Tue Feb 09 21:11:16 2016 +0300
@@ -52,10 +52,11 @@
     ThinkThread:= nil;
     SDL_UnlockMutex(ThreadLock);
 
-    with CurrentHedgehog^ do
-        if Gear <> nil then
-            if BotLevel <> 0 then
-                StopMessages(Gear^.Message);
+    if CurrentHedgehog <> nil then
+        with CurrentHedgehog^ do
+            if Gear <> nil then
+                if BotLevel <> 0 then
+                    StopMessages(Gear^.Message);
 
     BestActions.Count:= 0;
     BestActions.Pos:= 0
@@ -552,7 +553,7 @@
                 if Gear^.Message <> 0 then
                     begin
                     StopMessages(Gear^.Message);
-                    TryDo((Gear^.Message and gmAllStoppable) = 0, 'Engine bug: AI may break demos playing', true);
+                    if checkFails((Gear^.Message and gmAllStoppable) = 0, 'Engine bug: AI may break demos playing', true) then exit;
                     end;
 
                 if Gear^.Message <> 0 then