Przeglądaj źródła

logging: Fix creating empty file even when disabled (#2966)

* logging: Fix creating empty file even when disabled

* Minor formatting fix

Co-authored-by: staviq <staviq@gmail.com>

---------

Co-authored-by: staviq <staviq@gmail.com>
Kerfuffle 2 lat temu
rodzic
commit
3358c381f6
1 zmienionych plików z 6 dodań i 6 usunięć
  1. 6 6
      common/log.h

+ 6 - 6
common/log.h

@@ -341,14 +341,14 @@ inline FILE *log_handler1_impl(bool change = false, LogTriState disable = LogTri
         }
     }
 
-    if (_initialized)
+    if (_disabled)
     {
-        if (_disabled)
-        {
-            // Log is disabled
-            return nullptr;
-        }
+        // Log is disabled
+        return nullptr;
+    }
 
+    if (_initialized)
+    {
         // with fallback in case something went wrong
         return logfile ? logfile : stderr;
     }