Avoid adding empty arguments

QByteArray split does create one item even if the string is empty.
Hence check if the launch arguments string needs to be parsed at all.

Change-Id: I0a355212aaa7254fe0f417c61a59c30223311915
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
This commit is contained in:
Maurice Kalinowski 2013-10-31 15:09:39 +01:00 committed by The Qt Project
parent a9b6a78e54
commit 4f563f6bee

View File

@ -115,11 +115,13 @@ private:
m_argv.resize(m_argc);
HSTRING arguments;
launchArgs->get_Arguments(&arguments);
foreach (const QByteArray &arg, QString::fromWCharArray(
WindowsGetStringRawBuffer(arguments, nullptr)).toLocal8Bit().split(' ')) {
m_argv.append(qstrdup(arg.constData()));
if (arg == "-qdebug")
m_debugWait = true;
if (arguments) {
foreach (const QByteArray &arg, QString::fromWCharArray(
WindowsGetStringRawBuffer(arguments, nullptr)).toLocal8Bit().split(' ')) {
m_argv.append(qstrdup(arg.constData()));
if (arg == "-qdebug")
m_debugWait = true;
}
}
}
return S_OK;