summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@nokia.com>2012-07-17 11:19:02 +0200
committerQt by Nokia <qt-info@nokia.com>2012-07-31 11:58:08 +0200
commit67d082223c90912a88f5282af90d8fc05f4a389b (patch)
treed016132d13d9ed6f0fe22a8966438439be36adc8 /src/corelib
parent58ab483cdb685ee71daf4e68907a97481a411628 (diff)
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: Ib16ef7798ebcd1c9b8d661dd2e3ce3aadc393489 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Denis Dzyubenko <denis.dzyubenko@nokia.com>
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/tools/qlocale_mac.mm2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/tools/qlocale_mac.mm b/src/corelib/tools/qlocale_mac.mm
index 0a743324ef..f154f3efb4 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) {