From af59639826739a4c6c47e265ea0d41501d10bdc7 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 6 Jun 2018 10:38:06 +0200 Subject: [PATCH] App: centralize conversion from local8Bit Change-Id: I8def56fa3b613ba32dad69a2997b190fa76cab3c Reviewed-by: Tobias Hunger --- src/app/main.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/app/main.cpp b/src/app/main.cpp index 2c0b28ac70f..1c7c3947607 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -354,16 +354,17 @@ Options parseCommandLine(int argc, char *argv[]) while (it != end) { const auto arg = QString::fromLocal8Bit(*it); const bool hasNext = it + 1 != end; + const auto nextArg = hasNext ? QString::fromLocal8Bit(*(it + 1)) : QString(); if (arg == SETTINGS_OPTION && hasNext) { ++it; - options.settingsPath = QDir::fromNativeSeparators(QString::fromLocal8Bit(*it)); + options.settingsPath = QDir::fromNativeSeparators(nextArg); } else if (arg == INSTALL_SETTINGS_OPTION && hasNext) { ++it; - options.installSettingsPath = QDir::fromNativeSeparators(QString::fromLocal8Bit(*it)); + options.installSettingsPath = QDir::fromNativeSeparators(nextArg); } else if (arg == PLUGINPATH_OPTION && hasNext) { ++it; - options.customPluginPaths += QDir::fromNativeSeparators(QString::fromLocal8Bit(*it)); + options.customPluginPaths += QDir::fromNativeSeparators(nextArg); } else { // arguments that are still passed on to the application if (arg == TEST_OPTION) options.hasTestOption = true;