DEADSOFTWARE

panels: fix crash on liquid collision
authorDeaDDooMER <deaddoomer@deadsoftware.ru>
Thu, 16 Feb 2023 19:10:49 +0000 (22:10 +0300)
committerDeaDDooMER <deaddoomer@deadsoftware.ru>
Fri, 9 Jun 2023 09:14:52 +0000 (12:14 +0300)
src/game/g_panel.pas

index 70d2cc15fd4ff5c1deaa801dae3e2d98aaab9e28..f259aa3d18492575f0547abf1aae34aa18ec4780 100644 (file)
@@ -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;