From 03e9aacf11e8a91a3198cdfa51d75d9d9c8e675b Mon Sep 17 00:00:00 2001 From: gabime Date: Fri, 6 Dec 2024 15:27:13 +0200 Subject: [PATCH] Clean spdlog.cpp added assert --- src/spdlog.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/spdlog.cpp b/src/spdlog.cpp index 85296782..47539524 100644 --- a/src/spdlog.cpp +++ b/src/spdlog.cpp @@ -2,6 +2,7 @@ // Distributed under the MIT License (http://opensource.org/licenses/MIT) #include +#include #include "spdlog/spdlog.h" #include "spdlog/common.h" @@ -30,7 +31,10 @@ void set_global_logger(std::shared_ptr global_logger) { context()->set_logger(std::move(global_logger)); } -logger *global_logger_raw() noexcept { return context_ref()->global_logger_raw(); } +logger *global_logger_raw() noexcept { + assert(context_ref()->global_logger_raw() != nullptr); + return context_ref()->global_logger_raw(); +} void set_formatter(std::unique_ptr formatter) { global_logger()->set_formatter(std::move(formatter));