summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarkus Goetz <Markus.Goetz@nokia.com>2009-09-28 14:32:32 (GMT)
committerMarkus Goetz <Markus.Goetz@nokia.com>2009-09-28 14:33:50 (GMT)
commitb5d8b253b194f3261bf790362d80eacb97ff30b5 (patch)
treeb2faae0f66d43023c1218611cee1b53855972322 /src
parent2d1f2ceb7cd00db6e6cc72f614222d66dca6e23a (diff)
downloadQt-b5d8b253b194f3261bf790362d80eacb97ff30b5.zip
Qt-b5d8b253b194f3261bf790362d80eacb97ff30b5.tar.gz
Qt-b5d8b253b194f3261bf790362d80eacb97ff30b5.tar.bz2
getMacPreferredLanguageAndCountry: Fix possible crash
getMacPreferredLanguageAndCountry can crash when called e.g. as a root user because CFPreferencesCopyValue will return 0. Reviewed-by: denis Task-number: 261664
Diffstat (limited to 'src')
-rw-r--r--src/corelib/tools/qlocale.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index 136bafa..dc61adb 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -1156,7 +1156,7 @@ static void getMacPreferredLanguageAndCountry(QString *language, QString *countr
kCFPreferencesAnyApplication,
kCFPreferencesCurrentUser,
kCFPreferencesAnyHost);
- if (CFArrayGetCount(languages) > 0) {
+ if (languages && CFArrayGetCount(languages) > 0) {
QCFType<CFLocaleRef> locale = CFLocaleCreate(kCFAllocatorDefault,
CFStringRef(CFArrayGetValueAtIndex(languages, 0)));
if (language)