From 3cfef5a20480602c58f5710d1d10ddf11a4d2d82 Mon Sep 17 00:00:00 2001 From: d1str4ught <> Date: Mon, 22 Sep 2025 04:18:39 +0200 Subject: [PATCH] some safety checks for logging --- src/libthecore/log.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libthecore/log.cpp b/src/libthecore/log.cpp index 5d0528d..e00f43f 100644 --- a/src/libthecore/log.cpp +++ b/src/libthecore/log.cpp @@ -75,6 +75,9 @@ void log_destroy() void _sys_err(std::string_view str, const std::source_location& src_loc) { + if (!g_bLogInitialized) + return; + spdlog::source_loc loc; loc.funcname = src_loc.function_name(); loc.line = src_loc.line(); @@ -85,6 +88,9 @@ void _sys_err(std::string_view str, const std::source_location& src_loc) void _sys_log(int level, std::string_view str) { + if (!g_bLogInitialized) + return; + spdlog::level::level_enum lvl = spdlog::level::info; switch (level) {