From a61a630ee675e18f12e8725cca731cbe8aa429ce Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Wed, 3 Aug 2022 02:27:43 -0400 Subject: handle null from std::locale::locale (fixes #88) --- src/abaddon.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/abaddon.cpp') diff --git a/src/abaddon.cpp b/src/abaddon.cpp index 2e8ecaa..c849fd6 100644 --- a/src/abaddon.cpp +++ b/src/abaddon.cpp @@ -898,11 +898,15 @@ int main(int argc, char **argv) { char *systemLocale = std::setlocale(LC_ALL, ""); try { - std::locale::global(std::locale(systemLocale)); + if (systemLocale != nullptr) { + std::locale::global(std::locale(systemLocale)); + } } catch (...) { try { std::locale::global(std::locale::classic()); - std::setlocale(LC_ALL, systemLocale); + if (systemLocale != nullptr) { + std::setlocale(LC_ALL, systemLocale); + } } catch (...) {} } -- cgit v1.2.3