diff options
author | Lukas Matena <lukasmatena@seznam.cz> | 2022-05-26 11:11:49 +0300 |
---|---|---|
committer | supermerill <merill@free.fr> | 2022-08-10 21:58:55 +0300 |
commit | ac5d9068923c690e45195f41e2a611f099cc8eae (patch) | |
tree | 8787d4d725cbb771d8ec3fdd3013c236d084c3a1 | |
parent | 48b2cdfaf97e8d98eaef430d8073d5f1b33a013c (diff) |
Fix of 8299 (Linux crash when selecting locales)
-rw-r--r-- | src/slic3r/GUI/GUI_App.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 4c58fa2ec..4cf21a36c 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -2157,15 +2157,17 @@ static const wxLanguageInfo* linux_get_existing_locale_language(const wxLanguage }), locales.end()); - // Is there a candidate matching a country code of a system language? Move it to the end, - // while maintaining the order of matches, so that the best match ends up at the very end. - std::string system_country = "_" + into_u8(system_language->CanonicalName.AfterFirst('_')).substr(0, 2); - int cnt = locales.size(); - for (int i=0; i<cnt; ++i) - if (locales[i].find(system_country) != std::string::npos) { - locales.emplace_back(std::move(locales[i])); - locales[i].clear(); - } + if (system_language) { + // Is there a candidate matching a country code of a system language? Move it to the end, + // while maintaining the order of matches, so that the best match ends up at the very end. + std::string system_country = "_" + into_u8(system_language->CanonicalName.AfterFirst('_')).substr(0, 2); + int cnt = locales.size(); + for (int i=0; i<cnt; ++i) + if (locales[i].find(system_country) != std::string::npos) { + locales.emplace_back(std::move(locales[i])); + locales[i].clear(); + } + } // Now try them one by one. for (auto it = locales.rbegin(); it != locales.rend(); ++ it) |