From b9c89b381be708111ba824ebcd38c0ce9709f2b6 Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 5 Mar 2025 10:47:12 +0100 Subject: [PATCH] nullcheck for realpatch --- src/hardware/hw_cache.c | 11 +++++++---- src/hardware/hw_clip.c | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/hardware/hw_cache.c b/src/hardware/hw_cache.c index af06ecba6..f41547912 100644 --- a/src/hardware/hw_cache.c +++ b/src/hardware/hw_cache.c @@ -384,8 +384,11 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noe for (i = 0, patch = texture->patches; i < texture->patchcount; i++, patch++) { realpatch = W_CacheLumpNumPwad(patch->wad, patch->lump, PU_CACHE); - HWR_DrawTexturePatchInCache(&gltex->mipmap, blockwidth, blockheight, texture, patch, realpatch); - Z_ChangeTag(realpatch, PU_HWRCACHE_UNLOCKED); + if (realpatch != NULL) + { + HWR_DrawTexturePatchInCache(&gltex->mipmap, blockwidth, blockheight, texture, patch, realpatch); + Z_ChangeTag(realpatch, PU_HWRCACHE_UNLOCKED); + } } //Hurdler: not efficient at all but I don't remember exactly how HWR_DrawPatchInCache works :( @@ -637,8 +640,7 @@ static void HWR_CacheFlat(GLMipmap_t *glMipmap, lumpnum_t flatlumpnum) glMipmap->height = (UINT16)pflatsize; // the flat raw data needn't be converted with palettized textures - W_ReadLump(flatlumpnum, Z_Malloc(W_LumpLength(flatlumpnum), - PU_HWRCACHE, &glMipmap->data)); + W_ReadLump(flatlumpnum, Z_Malloc(size, PU_HWRCACHE, &glMipmap->data)); #ifdef GLENCORE flat = glMipmap->data; @@ -833,6 +835,7 @@ static void HWR_DrawFadeMaskInCache(GLMipmap_t *mipmap, INT32 pblockwidth, INT32 stepy = ((INT32)SHORT(fmheight)<= 180.0) return 0xffffffff;