Merge branch 'demo-quit-crash-fix' into 'next'

Fix crash if you start recording a replay and immediately close the game

See merge request STJr/SRB2!1082
This commit is contained in:
James R 2020-07-22 22:11:03 -04:00
commit 8d60579e6c

View file

@ -2382,9 +2382,12 @@ static void WriteDemoChecksum(void)
static void G_StopDemoRecording(void)
{
boolean saved = false;
WRITEUINT8(demo_p, DEMOMARKER); // add the demo end marker
WriteDemoChecksum();
saved = FIL_WriteFile(va(pandf, srb2home, demoname), demobuffer, demo_p - demobuffer); // finally output the file.
if (demo_p)
{
WRITEUINT8(demo_p, DEMOMARKER); // add the demo end marker
WriteDemoChecksum();
saved = FIL_WriteFile(va(pandf, srb2home, demoname), demobuffer, demo_p - demobuffer); // finally output the file.
}
free(demobuffer);
demorecording = false;