From 0303750a7b40951618dca290c172a7afa60e9aa8 Mon Sep 17 00:00:00 2001 From: Ashley 'LadyHavoc' Hale Date: Sat, 18 Sep 2021 14:50:14 -0700 Subject: [PATCH] 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. --- console.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) 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'; } -- 2.39.2