From 3358c381f6251bf6e65855e1c93bfaa9ec82ddb3 Mon Sep 17 00:00:00 2001 From: Kerfuffle <44031344+KerfuffleV2@users.noreply.github.com> Date: Sat, 2 Sep 2023 11:53:55 -0600 Subject: [PATCH] logging: Fix creating empty file even when disabled (#2966) * logging: Fix creating empty file even when disabled * Minor formatting fix Co-authored-by: staviq --------- Co-authored-by: staviq --- common/log.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/common/log.h b/common/log.h index bf9fafd68..0b9b01052 100644 --- a/common/log.h +++ b/common/log.h @@ -341,14 +341,14 @@ 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; }