From 28f7728980238b57061efe440afab8b19f3b9b79 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Tue, 25 Aug 2020 19:10:02 -0400 Subject: [PATCH] - fix a bug in the png renderer of the software renderer with decals: if the palette remap is missing, don't attempt to use it. (fix null pointer) --- src/common/textures/formats/pngtexture.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/common/textures/formats/pngtexture.cpp b/src/common/textures/formats/pngtexture.cpp index 48eb2437c..74474dede 100644 --- a/src/common/textures/formats/pngtexture.cpp +++ b/src/common/textures/formats/pngtexture.cpp @@ -360,7 +360,8 @@ void FPNGTexture::ReadAlphaRemap(FileReader *lump, uint8_t *alpharemap) uint8_t r = lump->ReadUInt8(); uint8_t g = lump->ReadUInt8(); uint8_t b = lump->ReadUInt8(); - alpharemap[i] = PaletteMap[i] == 0 ? 0 : Luminance(r, g, b); + int ti = PaletteMap ? PaletteMap[i] : i; + alpharemap[i] = ti == 0 ? 0 : Luminance(r, g, b); } lump->Seek(p, FileReader::SeekSet); }