--- a/hedgewars/uTextures.pas Fri Jan 01 19:15:32 2016 +0300
+++ b/hedgewars/uTextures.pas Tue Feb 09 21:11:16 2016 +0300
@@ -176,6 +176,9 @@
r, slr, w, si, li: LongWord;
begin
w:= surf^.w;
+ // just a single pixel, nothing to do here
+ if (w < 2) and (surf^.h < 2) then
+ exit;
slr:= surf^.h - 2;
si:= 0;
li:= w - 1;
@@ -226,7 +229,7 @@
if (surf^.format^.BytesPerPixel <> 4) then
begin
- TryDo(false, 'Surface2Tex failed, expecting 32 bit surface', true);
+ checkFails(false, 'Surface2Tex failed, expecting 32 bit surface', true);
Surface2Tex^.id:= 0;
exit
end;
@@ -236,7 +239,8 @@
glBindTexture(GL_TEXTURE_2D, Surface2Tex^.id);
if SDL_MustLock(surf) then
- SDLTry(SDL_LockSurface(surf) >= 0, 'Lock surface', true);
+ if SDLCheck(SDL_LockSurface(surf) >= 0, 'Lock surface', true) then
+ exit(nil);
fromP4:= Surf^.pixels;