diff options
author | Markus Goetz <Markus.Goetz@nokia.com> | 2009-09-28 14:32:32 (GMT) |
---|---|---|
committer | Markus Goetz <Markus.Goetz@nokia.com> | 2009-09-28 14:33:50 (GMT) |
commit | b5d8b253b194f3261bf790362d80eacb97ff30b5 (patch) | |
tree | b2faae0f66d43023c1218611cee1b53855972322 /src/corelib/tools | |
parent | 2d1f2ceb7cd00db6e6cc72f614222d66dca6e23a (diff) | |
download | Qt-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/corelib/tools')
-rw-r--r-- | src/corelib/tools/qlocale.cpp | 2 |
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) |