Fix an IO exception on exit when using -condebug because FS_Close was trying to log...
authorAshley 'LadyHavoc' Hale <darkplacesengine@gmail.com>
Sat, 18 Sep 2021 21:50:14 +0000 (14:50 -0700)
committerAshley 'LadyHavoc' Hale <darkplacesengine@gmail.com>
Sat, 18 Sep 2021 21:50:14 +0000 (14:50 -0700)
console.c

index 034cac0c262cb83432dcb6d952d64ecd9da95bf1..cd596418592a0b00fef50a234173c7b65a1bc8b5 100644 (file)
--- 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';
 }