Fix crash when no plugins are specified

In the case that no plugins are specified, the above code would assert
since we are not checking whether there is a value in the variable name.

Change-Id: Ia5922a6936aff179ca19fdd10e335133cd30daf4
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
bb10
Leander Beernaert 2019-07-23 11:51:12 +02:00
parent 6132260da3
commit 3eedb2fbd0
1 changed files with 6 additions and 2 deletions

View File

@ -1177,14 +1177,18 @@ Q_LOGGING_CATEGORY(lcQpaPluginLoading, "qt.qpa.plugin");
static void init_platform(const QString &pluginNamesWithArguments, const QString &platformPluginPath, const QString &platformThemeName, int &argc, char **argv)
{
QStringList plugins = pluginNamesWithArguments.split(QLatin1Char(';'));
QStringList plugins = pluginNamesWithArguments.split(QLatin1Char(';'), QString::SkipEmptyParts);
QStringList platformArguments;
QStringList availablePlugins = QPlatformIntegrationFactory::keys(platformPluginPath);
for (const auto &pluginArgument : plugins) {
// Split into platform name and arguments
QStringList arguments = pluginArgument.split(QLatin1Char(':'));
QStringList arguments = pluginArgument.split(QLatin1Char(':'), QString::SkipEmptyParts);
if (arguments.isEmpty())
continue;
const QString name = arguments.takeFirst().toLower();
QString argumentsKey = name;
if (name.isEmpty())
continue;
argumentsKey[0] = argumentsKey.at(0).toUpper();
arguments.append(QLibraryInfo::platformPluginArguments(argumentsKey));