hedgewars/uStore.pas
changeset 13821 94d0d1ab7a0e
parent 13642 3d14950641a4
child 13832 10a3b80130b5
--- a/hedgewars/uStore.pas	Tue Oct 02 21:26:25 2018 +0200
+++ b/hedgewars/uStore.pas	Tue Oct 02 21:51:27 2018 +0200
@@ -772,8 +772,9 @@
 var i: LongInt;
     f: PFSFile;
     key, value, l, temp: shortstring;
-    color: Longword;
-    c: byte;
+    color, tempColor: Longword;
+    clanID, tempClanID: byte;
+    conversionSuccess: boolean;
 begin
     if cOnlyStats then exit;
 
@@ -786,6 +787,7 @@
         while (not pfsEOF(f)) and (l <> '[colors]') do
             pfsReadLn(f, l);
 
+        conversionSuccess:= false;
         while (not pfsEOF(f)) and (l <> '') do
             begin
             pfsReadLn(f, l);
@@ -801,11 +803,11 @@
             if temp = 'color' then
                 begin
                 temp:= copy(key, 6, length(key) - 5);
-                try
-                    c:= StrToInt(temp);
-                except
-                    on E : EConvertError do continue;
-                end;
+                tempClanID:= StrToInt(temp, conversionSuccess);
+                if conversionSuccess then
+                    clanID:= tempClanID
+                else
+                    continue;
                 end
             else
                 continue;
@@ -820,15 +822,15 @@
                 if value[1] <> '#' then
                     continue;
                 temp:= copy(value, 2, length(value) - 1);
-                try
-                    color:= StrToInt('0x'+temp);
-                except
-                    on E : EConvertError do continue;
-                end;
+                tempColor:= StrToInt('0x'+temp, conversionSuccess);
+                if conversionSuccess then
+                    color:= tempColor
+                else
+                    continue;
                 end;
 
-            if c <= cClanColors then
-                ClanColorArray[c]:= color;
+            if clanID <= cClanColors then
+                ClanColorArray[clanID]:= color;
 
             end;