diff options
author | Eike Ziller <eike.ziller@nokia.com> | 2012-07-17 10:01:33 (GMT) |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-08-10 12:45:45 (GMT) |
commit | 7e6c9ffb95c5ac9f0180afe1809e17526b8a0893 (patch) | |
tree | 8d914ddd86b7ebce3bc2e7220ab834301ca45b74 | |
parent | 84e58e322fe2c3697a453e7ad072be9569c29479 (diff) | |
download | Qt-7e6c9ffb95c5ac9f0180afe1809e17526b8a0893.zip Qt-7e6c9ffb95c5ac9f0180afe1809e17526b8a0893.tar.gz Qt-7e6c9ffb95c5ac9f0180afe1809e17526b8a0893.tar.bz2 |
Mac: Don't crash if language preferences can't be retrieved.
That can happen when e.g. running an application with sudo.
Task-number: QTBUG-26547
Change-Id: I4b1d4b71716da4026dfa0f68bad905f0010d0968
(cherry-picked from 67d082223c90912a88f5282af90d8fc05f4a389b in Qt5)
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r-- | src/corelib/tools/qlocale_mac.mm | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/tools/qlocale_mac.mm b/src/corelib/tools/qlocale_mac.mm index 67a7d3f..c08148e 100644 --- a/src/corelib/tools/qlocale_mac.mm +++ b/src/corelib/tools/qlocale_mac.mm @@ -439,7 +439,7 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const kCFPreferencesAnyApplication, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); - const int cnt = CFArrayGetCount(languages); + const int cnt = languages == NULL ? 0 : CFArrayGetCount(languages); QStringList result; result.reserve(cnt); for (int i = 0; i < cnt; ++i) { |