From 75d061bbc68875c08b3dc243e464e32a80da71df Mon Sep 17 00:00:00 2001 From: Kirill Burtsev Date: Wed, 20 Jan 2021 15:18:42 +0100 Subject: Allow to fallback to default locale for non existent data packs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/core/resource_bundle_qt.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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*/) -- cgit v1.2.3