From: DeaDDooMER Date: Thu, 16 Feb 2023 19:10:49 +0000 (+0300) Subject: panels: fix crash on liquid collision X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=b4e158834e92ec5c007a8af5a116855b8062c82d;p=d2df-sdl.git panels: fix crash on liquid collision --- diff --git a/src/game/g_panel.pas b/src/game/g_panel.pas index 70d2cc1..f259aa3 100644 --- a/src/game/g_panel.pas +++ b/src/game/g_panel.pas @@ -922,10 +922,13 @@ end; if (FCurTexture >= 0) then begin Texture := FTextureIDs[FCurTexture].Texture; - case Textures[Texture].TextureName of - TEXTURE_NAME_WATER: Result := DWORD(TEXTURE_SPECIAL_WATER); - TEXTURE_NAME_ACID1: Result := DWORD(TEXTURE_SPECIAL_ACID1); - TEXTURE_NAME_ACID2: Result := DWORD(TEXTURE_SPECIAL_ACID2); + if Texture >= 0 then + begin + case Textures[Texture].TextureName of (* TODO: optimize it *) + TEXTURE_NAME_WATER: Result := DWORD(TEXTURE_SPECIAL_WATER); + TEXTURE_NAME_ACID1: Result := DWORD(TEXTURE_SPECIAL_ACID1); + TEXTURE_NAME_ACID2: Result := DWORD(TEXTURE_SPECIAL_ACID2); + end end end end;