Fix lack of message and segfault when number texture creation fails
authorunc0rr
Fri, 26 Oct 2018 19:53:07 +0200
changeset 14011 b9b1d74b7fef
parent 14010 a8ffc92a0982
child 14012 4ae01eabf611
Fix lack of message and segfault when number texture creation fails
hedgewars/uStore.pas
--- a/hedgewars/uStore.pas	Fri Oct 26 17:51:43 2018 +0200
+++ b/hedgewars/uStore.pas	Fri Oct 26 19:53:07 2018 +0200
@@ -534,6 +534,7 @@
     for i:= Low(CountTexz) to High(CountTexz) do
         begin
         tmpsurf:= TTF_RenderUTF8_Blended(Fontz[CheckCJKFont(trmsg[sidAmmoCount],fnt16)].Handle, Str2PChar(Format(shortstring(trmsg[sidAmmoCount]), IntToStr(i))), cWhiteColorChannels);
+        if checkFails(tmpsurf <> nil,'Number texture creation for ammo type #' + intToStr(ord(ai)) + ' failed!',true) then exit;
         tmpsurf:= doSurfaceConversion(tmpsurf);
         FreeAndNilTexture(CountTexz[i]);
         CountTexz[i]:= Surface2Tex(tmpsurf, false);