From 201ead11ea2991a6b76979542e582e5d6d94b4f7 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 3 Feb 2025 14:41:10 +0100 Subject: [PATCH] check for realpatch here too --- src/hardware/hw_cache.c | 7 +++++-- src/r_data.c | 5 +++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/hardware/hw_cache.c b/src/hardware/hw_cache.c index af06ecba6..ab278989b 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 :( diff --git a/src/r_data.c b/src/r_data.c index 3d4b69590..4a90709e1 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -282,6 +282,11 @@ static UINT8 *R_GenerateTexture(size_t texnum) for (i = 0, patch = texture->patches; i < texture->patchcount; i++, patch++) { realpatch = W_CacheLumpNumPwad(patch->wad, patch->lump, PU_LEVEL); + + // Well, it's not valid... + if (realpatch == NULL) + continue; + x1 = patch->originx; x2 = x1 + SHORT(realpatch->width);