From 81cfca29d8c041fa1b4b8522e0ec128e2d0a5e2c Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Wed, 4 Dec 2019 15:50:17 -0300 Subject: [PATCH] Fix FreeMipmapColormap yet again --- src/hardware/hw_cache.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/hardware/hw_cache.c b/src/hardware/hw_cache.c index 2d4704b8b..328e623bd 100644 --- a/src/hardware/hw_cache.c +++ b/src/hardware/hw_cache.c @@ -781,9 +781,12 @@ static void FreeMipmapColormap(INT32 patchnum, void *patch) // Confusing at first, but pat->mipmap->nextcolormap // at the beginning of the loop is the first colormap // from the linked list of colormaps - GLMipmap_t *next = pat->mipmap->nextcolormap; + GLMipmap_t *next = pat->mipmap; + if (!next) // No mipmap in this patch, break out of loop. + break; // Set the first colormap // to the one that comes after it + next = next->nextcolormap; pat->mipmap->nextcolormap = next->nextcolormap; // Free image data from memory if (next->grInfo.data)