From 3eedb2fbd08ab73bfe3e9a8456f2c5228637b52a Mon Sep 17 00:00:00 2001 From: Leander Beernaert Date: Tue, 23 Jul 2019 11:51:12 +0200 Subject: [PATCH] Fix crash when no plugins are specified MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Tor Arne Vestbø --- src/gui/kernel/qguiapplication.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 426f2aeece..a7fe2ec50a 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -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));