handle null from std::locale::locale (fixes #88)

This commit is contained in:
ouwou
2022-08-03 02:27:43 -04:00
parent 4e4986f670
commit a61a630ee6

View File

@@ -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 (...) {}
}