summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKirill Burtsev <kirill.burtsev@qt.io>2021-01-20 15:18:42 +0100
committerKirill Burtsev <kirill.burtsev@qt.io>2021-01-20 19:08:59 +0000
commit75d061bbc68875c08b3dc243e464e32a80da71df (patch)
tree9818910ef7c33488fbe4d736db46bde5c8261d05
parent2b6f6ad066123253b65449033eddcee8b20c470b (diff)
Allow to fallback to default locale for non existent data packs
Fix crash for locales, for which there is no pak data file (like en-DE). Match original chromium's implementation for LocaleDataPakExists by checking if path for file exists in order to not to try to load invalid non-existent pack file. Change-Id: I47c5cc97c09bdf8e78dcff024d82796d4c419f2c Fixes: QTBUG-90490 Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
-rw-r--r--src/core/resource_bundle_qt.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/core/resource_bundle_qt.cpp b/src/core/resource_bundle_qt.cpp
index d31b4d2e4..22622f216 100644
--- a/src/core/resource_bundle_qt.cpp
+++ b/src/core/resource_bundle_qt.cpp
@@ -38,6 +38,7 @@
****************************************************************************/
#include "base/command_line.h"
+#include "base/files/file_util.h"
#include "base/logging.h"
#include "base/metrics/histogram_macros.h"
#include "base/notreached.h"
@@ -89,7 +90,8 @@ bool ResourceBundle::LocaleDataPakExists(const std::string& locale)
}
#endif
- return !GetLocaleFilePath(locale).empty();
+ const auto path = GetLocaleFilePath(locale);
+ return !path.empty() && base::PathExists(path);
}
std::string ResourceBundle::LoadLocaleResources(const std::string &pref_locale, bool /*crash_on_failure*/)