From 7177b396e05ab3a94045b3abca05b55b0c8eeb7d Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 5 Jan 2025 23:02:27 +0100 Subject: [PATCH] any of those may be NULL in MakePatch no idea but this crap keeps crashing in some other place every single time i add a check somewhere else --- src/hardware/hw_cache.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/hardware/hw_cache.c b/src/hardware/hw_cache.c index ad140c025..65e120002 100644 --- a/src/hardware/hw_cache.c +++ b/src/hardware/hw_cache.c @@ -410,6 +410,16 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noe // patch may be NULL if glMipmap has been initialised already and makebitmap is false void HWR_MakePatch (patch_t *patch, GLPatch_t *glPatch, GLMipmap_t *glMipmap, boolean makebitmap) { + if (glMipmap == NULL) + return; + + if (patch == NULL || glPatch == NULL) + { + Z_Free(glMipmap->data); + glMipmap->data = NULL; + return; + } + // don't do it twice (like a cache) if (glMipmap->width == 0) {