From be3672b83107a7760f43e20300bdd5463790ae75 Mon Sep 17 00:00:00 2001 From: Fabian Greffrath Date: Fri, 10 Jan 2020 12:05:36 +0100 Subject: [PATCH] fix crash when a demo lump is empty Fixes #23 --- Source/g_game.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Source/g_game.c b/Source/g_game.c index bf51eafa..33c9aea3 100644 --- a/Source/g_game.c +++ b/Source/g_game.c @@ -1124,6 +1124,15 @@ static void G_DoPlayDemo(void) demobuffer = demo_p = W_CacheLumpName (basename, PU_STATIC); // killough + // [FG] ignore empty demo lumps + if (!demobuffer) + { + gameaction = ga_nothing; + demoplayback = true; + G_CheckDemoStatus(); + return; + } + // killough 2/22/98, 2/28/98: autodetect old demos and act accordingly. // Old demos turn on demo_compatibility => compatibility; new demos load // compatibility flag, and other flags as well, as a part of the demo. @@ -2508,7 +2517,11 @@ boolean G_CheckDemoStatus(void) if (singledemo) exit(0); // killough + // [FG] ignore empty demo lumps + if (demobuffer) + { Z_ChangeTag(demobuffer, PU_CACHE); + } G_ReloadDefaults(); // killough 3/1/98 netgame = false; // killough 3/29/98 deathmatch = false;