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>
This commit is contained in:
Friedemann Kleint 2015-09-24 08:42:06 +02:00
parent e87df57abf
commit bf2c9fd2fd

View File

@ -65,6 +65,7 @@ QString QPlatformInputContextFactory::requested()
QPlatformInputContext *QPlatformInputContextFactory::create(const QString& key)
{
#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
if (!key.isEmpty()) {
QStringList paramList = key.split(QLatin1Char(':'));
const QString platform = paramList.takeFirst().toLower();
@ -74,6 +75,7 @@ QPlatformInputContext *QPlatformInputContextFactory::create(const QString& key)
return ic;
delete ic;
}
#endif
return 0;
}