From: Ashley 'LadyHavoc' Hale Date: Sat, 18 Sep 2021 21:50:14 +0000 (-0700) Subject: Fix an IO exception on exit when using -condebug because FS_Close was trying to log... X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=commitdiff_plain;h=0303750a7b40951618dca290c172a7afa60e9aa8 Fix an IO exception on exit when using -condebug because FS_Close was trying to log something but the logfile is already closed, now tracks logfile in a local variable so logfile can be set to NULL sooner. --- diff --git a/console.c b/console.c index 034cac0c..cd596418 100644 --- a/console.c +++ b/console.c @@ -524,14 +524,16 @@ Log_Close */ void Log_Close (void) { - if (logfile == NULL) - return; + qfile_t* l = logfile; - FS_Print (logfile, Log_Timestamp ("Log stopped")); - FS_Print (logfile, "\n"); - FS_Close (logfile); + if (l == NULL) + return; + FS_Print (l, Log_Timestamp ("Log stopped")); + FS_Print (l, "\n"); logfile = NULL; + FS_Close (l); + crt_log_file[0] = '\0'; }