# HG changeset patch # User alfadur # Date 1536771105 -10800 # Node ID 720dc03600c99b4999777688a0c61dff2ad20c26 # Parent 8a7699ccb6086dcdbc86644905fb6462b9903808 Fix engine crash when using lasersight outside the world bounds diff -r 8a7699ccb608 -r 720dc03600c9 hedgewars/uGearsRender.pas --- a/hedgewars/uGearsRender.pas Tue Sep 11 22:49:27 2018 +0200 +++ b/hedgewars/uGearsRender.pas Wed Sep 12 19:51:45 2018 +0300 @@ -301,7 +301,7 @@ sign, hx, hy, tx, ty, sx, sy, m: LongInt; // hedgehog, crosshair, temp, sprite, direction dx, dy, ax, ay, aAngle, dAngle, hAngle, lx, ly: real; // laser, change wraps: LongWord; // numbe of wraps for laser in world wrap - defaultPos, HatVisible: boolean; + defaultPos, HatVisible, inWorldBounds: boolean; HH: PHedgehog; CurWeapon: PAmmo; iceOffset:Longint; @@ -444,7 +444,8 @@ hx:= tx; hy:= ty; wraps:= 0; - while ((Land[ty, tx] and lfAll) = 0) do + inWorldBounds := ((ty and LAND_HEIGHT_MASK) or (tx and LAND_WIDTH_MASK)) = 0; + while inWorldBounds and ((Land[ty, tx] and lfAll) = 0) do begin if wraps > cMaxLaserSightWraps then break;