From 019f30dfcb6c9c154d20d6642d622479b9139404 Mon Sep 17 00:00:00 2001 From: KerfuffleV2 Date: Sat, 2 Sep 2023 03:18:36 -0600 Subject: [PATCH] logging: Fix creating empty file even when disabled --- common/log.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/common/log.h b/common/log.h index bf9fafd68..cbee2fd8d 100644 --- a/common/log.h +++ b/common/log.h @@ -341,14 +341,13 @@ inline FILE *log_handler1_impl(bool change = false, LogTriState disable = LogTri } } + if (_disabled) + { + // Log is disabled + return nullptr; + } if (_initialized) { - if (_disabled) - { - // Log is disabled - return nullptr; - } - // with fallback in case something went wrong return logfile ? logfile : stderr; }