Merge branch 'mapheader-alloc-fix' into 'next'

Fix R_SkinUsable crashes in (some) custom addons

Closes #994

See merge request STJr/SRB2!1962
This commit is contained in:
MascaraSnake 2023-04-12 08:01:50 +00:00
commit efee750874
2 changed files with 3 additions and 1 deletions

View file

@ -2503,6 +2503,8 @@ void F_StartTitleScreen(void)
{
titlemapinaction = TITLEMAP_OFF;
gamemap = 1; // g_game.c
if (!mapheaderinfo[gamemap-1])
P_AllocMapHeader(gamemap-1);
CON_ClearHUD();
}

View file

@ -225,7 +225,7 @@ boolean R_SkinUsable(INT32 playernum, INT32 skinnum)
return true;
}
if (Playing() && (R_SkinAvailable(mapheaderinfo[gamemap-1]->forcecharacter) == skinnum))
if (Playing() && mapheaderinfo[gamemap-1] && (R_SkinAvailable(mapheaderinfo[gamemap-1]->forcecharacter) == skinnum))
{
// Force 1.
return true;