diff options
authorRichard Moe Gustavsen <>2014-04-09 15:46:26 +0200
committerThe Qt Project <>2014-04-16 12:26:43 +0200
commit839c54e070727540570b5994908d461bb7bb4dfd (patch)
parent3f9ad1efd61c76fe0671d28aac9e4886951856ec (diff)
iOS: fix crash in auto correction when using unknown font family
If QFont reports a family name that cannot be used to instanciate a UIFont, we end up trying to insert a nil object to an NSDictionary. This will raise an exception. This patch will check that we have a valid UIFont before using it. Task-number: QTBUG-38018 Change-Id: Id8a2e4afea8c915ff43a7e4680304ba19328f9c2 Reviewed-by: Gabriel de Dietrich <>
1 files changed, 2 insertions, 0 deletions
diff --git a/src/plugins/platforms/ios/ b/src/plugins/platforms/ios/
index 28fb23d57b..3f6c6d1256 100644
--- a/src/plugins/platforms/ios/
+++ b/src/plugins/platforms/ios/
@@ -473,6 +473,8 @@ Q_GLOBAL_STATIC(StaticVariables, staticVariables);
QCoreApplication::sendEvent(focusObject, &e);
QFont qfont = qvariant_cast<QFont>(e.value(Qt::ImFont));
UIFont *uifont = [UIFont size:qfont.pointSize()];
+ if (!uifont)
+ return [NSDictionary dictionary];
return [NSDictionary dictionaryWithObject:uifont forKey:UITextInputTextFontKey];