hedgewars/uWorld.pas
changeset 6380 1ff5ad1d771b
parent 6302 db8bdbb34e03
child 6394 f0a9042e7387
--- a/hedgewars/uWorld.pas	Mon Nov 14 17:56:44 2011 -0500
+++ b/hedgewars/uWorld.pas	Mon Nov 14 18:08:36 2011 -0500
@@ -1087,12 +1087,10 @@
         if t < 10 then s:= '0' + s;
         s:= inttostr(i div 60) + ':' + s;
    
-        if timeTexture <> nil then
-            FreeTexture(timeTexture);
-        timeTexture:= nil;
     
         tmpSurface:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(s), cWhiteColorChannels);
         tmpSurface:= doSurfaceConversion(tmpSurface);
+        FreeTexture(timeTexture);
         timeTexture:= Surface2Tex(tmpSurface, false);
         SDL_FreeSurface(tmpSurface)
     end;
@@ -1108,11 +1106,9 @@
             Frames:= 0;
             CountTicks:= 0;
             s:= inttostr(FPS) + ' fps';
-            if fpsTexture <> nil then
-                FreeTexture(fpsTexture);
-            fpsTexture:= nil;
             tmpSurface:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(s), cWhiteColorChannels);
             tmpSurface:= doSurfaceConversion(tmpSurface);
+            FreeTexture(fpsTexture);
             fpsTexture:= Surface2Tex(tmpSurface, false);
             SDL_FreeSurface(tmpSurface)
         end;
@@ -1316,9 +1312,7 @@
 
 if time = 0 then time:= 5000;
 missionTimer:= time;
-if missionTex <> nil then
-    FreeTexture(missionTex);
-missionTex:= nil;
+FreeTexture(missionTex);
 
 if icon > -1 then
     begin
@@ -1384,8 +1378,11 @@
 begin
     stereoDepth:= stereoDepth; // avoid hint
     FreeTexture(fpsTexture);
+    fpsTexture:= nil;
     FreeTexture(timeTexture);
+    timeTexture:= nil;
     FreeTexture(missionTex);
+    missionTex:= nil
 end;
 
 end.