hedgewars/GSHandlers.inc
changeset 601 78a68cc4d846
parent 590 e816adf4a27f
child 602 f7628ebfccde
--- a/hedgewars/GSHandlers.inc	Tue Sep 18 19:52:46 2007 +0000
+++ b/hedgewars/GSHandlers.inc	Thu Sep 20 20:00:10 2007 +0000
@@ -866,7 +866,7 @@
                              team: PTeam;
                              SortFactor: QWord;
                              end;
-    currsorter: PGear;
+    currsorter: PGear = nil;
 
 procedure doStepTeamHealthSorterWork(Gear: PGear);
 var i: LongInt;
@@ -906,7 +906,8 @@
       SortFactor:= (SortFactor shl 30) + TeamsArray[t]^.TeamHealth;
       end;
 
-repeat
+if TeamsCount > 1 then
+  repeat
     b:= true;
     for t:= 0 to TeamsCount - 2 do
         if (thexchar[t].SortFactor > thexchar[Succ(t)].SortFactor) then
@@ -916,7 +917,7 @@
            thexchar[Succ(t)]:= thexchar[cMaxTeams];
            b:= false
            end
-until b;
+  until b;
 
 t:= cScreenHeight - 4;
 for i:= 0 to Pred(TeamsCount) do