From 57b92b9491d7733a410a1d6929f6ef353c2ae289 Mon Sep 17 00:00:00 2001 From: NepDisk <16447892+NepDisk@users.noreply.github.com> Date: Tue, 22 Oct 2024 02:44:53 -0400 Subject: [PATCH] prevent map command crash from maps with invalid or non existing mapinfo https://github.com/Indev450/SRB2Kart-Saturn/commit/dba7a7dc3cb55ea4d8885f28e29edf3d22eeaef9 --- src/d_netcmd.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 6e798af1e..2c76b7581 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -2862,6 +2862,15 @@ static void Command_Map_f(void) // G_TOLFlag handles both multiplayer gametype and ignores it for !multiplayer else { + + if (!mapheaderinfo[newmapnum-1] || mapheaderinfo[newmapnum-1] == NULL) + { + CONS_Alert(CONS_WARNING, M_GetText("Invalid mapheaderinfo for Course %s (%s)\n"), realmapname, G_BuildMapName(newmapnum)); + Z_Free(realmapname); + Z_Free(mapname); + return; + } + if (!( mapheaderinfo[newmapnum-1] && mapheaderinfo[newmapnum-1]->typeoflevel & G_TOLFlag(newgametype)