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;