summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-09-24 08:42:06 +0200
committerFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-09-24 12:35:01 +0000
commitbf2c9fd2fdff2760f3798fd1584f2da330266c46 (patch)
tree4ff23a478b1937ecc9c141cfc0f74fe833d55223 /src
parente87df57abfdd2df821bfed54a5dc3f2380b36486 (diff)
Guard against empty keys in QPlatformInputContextFactory::create().
The code relied on QStringList::split() returning a list consisting of one empty string when passing an enpty string. Add a check to prevent the plugin loader from trying to load in this case. Change-Id: Iadb418d32fdea1d472d6c00726ad039b4afbf409 Reviewed-by: Andy Shaw <andy.shaw@theqtcompany.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/gui/kernel/qplatforminputcontextfactory.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/gui/kernel/qplatforminputcontextfactory.cpp b/src/gui/kernel/qplatforminputcontextfactory.cpp
index 9d55b778ce..fedf940dda 100644
--- a/src/gui/kernel/qplatforminputcontextfactory.cpp
+++ b/src/gui/kernel/qplatforminputcontextfactory.cpp
@@ -65,15 +65,17 @@ QString QPlatformInputContextFactory::requested()
QPlatformInputContext *QPlatformInputContextFactory::create(const QString& key)
{
#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
- QStringList paramList = key.split(QLatin1Char(':'));
- const QString platform = paramList.takeFirst().toLower();
+ if (!key.isEmpty()) {
+ QStringList paramList = key.split(QLatin1Char(':'));
+ const QString platform = paramList.takeFirst().toLower();
- QPlatformInputContext *ic = qLoadPlugin1<QPlatformInputContext, QPlatformInputContextPlugin>
- (loader(), platform, paramList);
- if (ic && ic->isValid())
- return ic;
+ QPlatformInputContext *ic = qLoadPlugin1<QPlatformInputContext, QPlatformInputContextPlugin>
+ (loader(), platform, paramList);
+ if (ic && ic->isValid())
+ return ic;
- delete ic;
+ delete ic;
+ }
#endif
return 0;
}