From 54a8259b42844d698a275295a84e73e4fb3c87e5 Mon Sep 17 00:00:00 2001 From: gabime Date: Fri, 25 Sep 2020 15:03:13 +0300 Subject: [PATCH] Fix #1680 --- include/spdlog/cfg/env.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/spdlog/cfg/env.h b/include/spdlog/cfg/env.h index 98d63a22..e2dc5717 100644 --- a/include/spdlog/cfg/env.h +++ b/include/spdlog/cfg/env.h @@ -28,8 +28,11 @@ namespace cfg { inline void load_env_levels() { auto env_val = details::os::getenv("SPDLOG_LEVEL"); - auto levels = helpers::extract_levels(env_val); - details::registry::instance().update_levels(std::move(levels)); + if (!env_val.empty()) + { + auto levels = helpers::extract_levels(env_val); + details::registry::instance().update_levels(std::move(levels)); + } } } // namespace cfg