# HG changeset patch # User unC0Rr # Date 1455018006 -10800 # Node ID c22d292e7266fa0060845e1235d5a24b3db188e2 # Parent 00860966354dbb2d446f7a286a1f767fd49c8292 Fix possible crashes/hangs due to recent changes diff -r 00860966354d -r c22d292e7266 hedgewars/uGame.pas --- a/hedgewars/uGame.pas Mon Feb 08 14:58:36 2016 +0300 +++ b/hedgewars/uGame.pas Tue Feb 09 14:40:06 2016 +0300 @@ -88,7 +88,7 @@ end; PlayNextVoice; i:= 1; -while (GameState <> gsExit) and (i <= Lag) do +while (GameState <> gsExit) and (i <= Lag) and allOK do begin if not CurrentTeam^.ExtDriven then begin diff -r 00860966354d -r c22d292e7266 hedgewars/uGearsList.pas --- a/hedgewars/uGearsList.pas Mon Feb 08 14:58:36 2016 +0300 +++ b/hedgewars/uGearsList.pas Tue Feb 09 14:40:06 2016 +0300 @@ -150,7 +150,8 @@ AddFileLog('Attempted to remove Gear #'+inttostr(Gear^.uid)+' from the list twice.'); exit end; -if checkFails((Gear = nil) or (curHandledGear = nil) or (Gear = curHandledGear), 'You''re doing it wrong', true) then exit; + +checkFails((Gear = nil) or (curHandledGear = nil) or (Gear = curHandledGear), 'You''re doing it wrong', true); if Gear^.NextGear <> nil then Gear^.NextGear^.PrevGear:= Gear^.PrevGear; diff -r 00860966354d -r c22d292e7266 hedgewars/uIO.pas --- a/hedgewars/uIO.pas Mon Feb 08 14:58:36 2016 +0300 +++ b/hedgewars/uIO.pas Tue Feb 09 14:40:06 2016 +0300 @@ -234,13 +234,13 @@ begin s[0]:= char(i); ss:= ss + s; - while (Length(ss) > 1)and(Length(ss) > byte(ss[1])) do + while (Length(ss) > 1)and(Length(ss) > byte(ss[1])) and allOK do begin ParseIPCCommand(copy(ss, 2, byte(ss[1]))); Delete(ss, 1, Succ(byte(ss[1]))); end end -until i = 0; +until (i = 0) or (not allOK); close(f) {$I+} @@ -328,7 +328,7 @@ repeat IPCCheckSock; SDL_Delay(1) -until isPonged +until isPonged or (not allOK) end; procedure SendIPCAndWaitReply(s: shortstring); diff -r 00860966354d -r c22d292e7266 hedgewars/uLand.pas --- a/hedgewars/uLand.pas Mon Feb 08 14:58:36 2016 +0300 +++ b/hedgewars/uLand.pas Tue Feb 09 14:40:06 2016 +0300 @@ -668,6 +668,8 @@ FreeLandObjects; +if not allOK then exit; + if GrayScale then begin if (cReducedQuality and rqBlurryLand) = 0 then diff -r 00860966354d -r c22d292e7266 hedgewars/uLandObjects.pas --- a/hedgewars/uLandObjects.pas Mon Feb 08 14:58:36 2016 +0300 +++ b/hedgewars/uLandObjects.pas Tue Feb 09 14:40:06 2016 +0300 @@ -525,7 +525,7 @@ ThemeObjects.Count:= 0; SprayObjects.Count:= 0; -while not pfsEOF(f) do +while (not pfsEOF(f)) and allOK do begin pfsReadLn(f, s); if Length(s) = 0 then diff -r 00860966354d -r c22d292e7266 hedgewars/uStore.pas --- a/hedgewars/uStore.pas Mon Feb 08 14:58:36 2016 +0300 +++ b/hedgewars/uStore.pas Tue Feb 09 14:40:06 2016 +0300 @@ -396,6 +396,7 @@ and ((cCloudsNumber > 0) or (ii <> sprCloud)) and ((vobCount > 0) or (ii <> sprFlake)) and (savesurf or (not cOnlyStats)) // in stats-only only load those which are needed later + and allOK then begin if reload then @@ -454,7 +455,7 @@ Surface:= nil end; -if not cOnlyStats then +if (not cOnlyStats) and allOK then begin WriteNames(fnt16); diff -r 00860966354d -r c22d292e7266 hedgewars/uTeams.pas --- a/hedgewars/uTeams.pas Mon Feb 08 14:58:36 2016 +0300 +++ b/hedgewars/uTeams.pas Tue Feb 09 14:40:06 2016 +0300 @@ -608,14 +608,18 @@ // color is always little endian so the mask must be constant also in big endian archs Color:= Color or $FF000000; AddTeam(Color); - CurrentTeam^.TeamName:= ts; - CurrentTeam^.PlayerHash:= s; - loadTeamBinds(ts); + + if CurrentTeam <> nil then + begin + CurrentTeam^.TeamName:= ts; + CurrentTeam^.PlayerHash:= s; + loadTeamBinds(ts); - if GameType in [gmtDemo, gmtSave, gmtRecord] then - CurrentTeam^.ExtDriven:= true; + if GameType in [gmtDemo, gmtSave, gmtRecord] then + CurrentTeam^.ExtDriven:= true; - CurrentTeam^.voicepack:= AskForVoicepack('Default') + CurrentTeam^.voicepack:= AskForVoicepack('Default') + end end end;