From b4e158834e92ec5c007a8af5a116855b8062c82d Mon Sep 17 00:00:00 2001 From: DeaDDooMER Date: Thu, 16 Feb 2023 22:10:49 +0300 Subject: [PATCH 1/1] panels: fix crash on liquid collision --- src/game/g_panel.pas | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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; -- 2.29.2