Fix crash when explosion is outside of the map (check was lost while refactoring)
authorunc0rr
Sun, 01 Mar 2009 17:36:44 +0000
changeset 1852 fa04a27005c3
parent 1851 b3b07f16a70d
child 1853 5618915f9ea4
Fix crash when explosion is outside of the map (check was lost while refactoring)
hedgewars/uLandTexture.pas
--- a/hedgewars/uLandTexture.pas	Sun Mar 01 17:31:09 2009 +0000
+++ b/hedgewars/uLandTexture.pas	Sun Mar 01 17:36:44 2009 +0000
@@ -52,6 +52,7 @@
 procedure UpdateLandTexture(X, Width, Y, Height: LongInt);
 var tx, ty: Longword;
 begin
+if (Width <= 0) or (Height <= 0) then exit;
 TryDo((X >= 0) and (X < LAND_WIDTH), 'UpdateLandTexture: wrong X parameter', true);
 TryDo(X + Width <= LAND_WIDTH, 'UpdateLandTexture: wrong Width parameter', true);
 TryDo((Y >= 0) and (Y < LAND_HEIGHT), 'UpdateLandTexture: wrong Y parameter', true);