mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-12 21:01:00 +00:00
add more safety
This commit is contained in:
parent
4df9749570
commit
e3c42b3ba2
1 changed files with 7 additions and 3 deletions
|
@ -481,7 +481,7 @@ static void FreeMipmapColormap(INT32 patchnum, void *patch)
|
||||||
{
|
{
|
||||||
GLPatch_t* const pat = patch;
|
GLPatch_t* const pat = patch;
|
||||||
(void)patchnum; //unused
|
(void)patchnum; //unused
|
||||||
|
|
||||||
// The patch must be valid, obviously
|
// The patch must be valid, obviously
|
||||||
if (!pat)
|
if (!pat)
|
||||||
return;
|
return;
|
||||||
|
@ -498,19 +498,23 @@ static void FreeMipmapColormap(INT32 patchnum, void *patch)
|
||||||
if (!pat->mipmap)
|
if (!pat->mipmap)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// No colormap mipmap either.
|
// No colormap mipmaps either.
|
||||||
if (!pat->mipmap->nextcolormap)
|
if (!pat->mipmap->nextcolormap)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Set the first colormap to the one that comes after it.
|
// Set the first colormap to the one that comes after it.
|
||||||
next = pat->mipmap->nextcolormap;
|
next = pat->mipmap->nextcolormap;
|
||||||
|
if (!next)
|
||||||
|
break;
|
||||||
|
|
||||||
pat->mipmap->nextcolormap = next->nextcolormap;
|
pat->mipmap->nextcolormap = next->nextcolormap;
|
||||||
|
|
||||||
// Free image data from memory.
|
// Free image data from memory.
|
||||||
if (next->grInfo.data)
|
if (next->grInfo.data)
|
||||||
Z_Free(next->grInfo.data);
|
Z_Free(next->grInfo.data);
|
||||||
|
next->grInfo.data = NULL;
|
||||||
|
|
||||||
// Free the old colormap from memory.
|
// Free the old colormap mipmap from memory.
|
||||||
free(next);
|
free(next);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue