summaryrefslogtreecommitdiffstats
path: root/src/winmain/qtmain_winrt.cpp
diff options
context:
space:
mode:
authorOliver Wolff <oliver.wolff@qt.io>2019-05-17 09:12:45 +0200
committerOliver Wolff <oliver.wolff@qt.io>2019-05-17 09:26:33 +0000
commita96a33d993618d5326e16ffb1b5028a94ceb4af2 (patch)
tree989f2d45466459048487d86cd90c5b234000c028 /src/winmain/qtmain_winrt.cpp
parentb7aea2bcd3b67031066e9c23f1827d4c83cfe1f3 (diff)
qtmain_winrt: Avoid nullptrs in str*cmp which cause crashes
When bringing an application back to foreground, args may contain NULL. These nullptrs should not cause application crashes. Fixes: QTBUG-75843 Change-Id: I642e3c359216e7706bcb13508399999a51a4fc2d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/winmain/qtmain_winrt.cpp')
-rw-r--r--src/winmain/qtmain_winrt.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/winmain/qtmain_winrt.cpp b/src/winmain/qtmain_winrt.cpp
index 7cc57f4d46..1828c4ca16 100644
--- a/src/winmain/qtmain_winrt.cpp
+++ b/src/winmain/qtmain_winrt.cpp
@@ -317,23 +317,26 @@ private:
if (quote)
break;
commandLine[i] = '\0';
- if (args.last()[0] != '\0')
+ if (!args.isEmpty() && args.last() && args.last()[0] != '\0')
args.append(commandLine.data() + i + 1);
// fall through
default:
- if (args.last()[0] == '\0')
+ if (!args.isEmpty() && args.last() && args.last()[0] == '\0')
args.last() = commandLine.data() + i;
escape = false; // only quotes are escaped
break;
}
}
- if (args.count() >= 2 && strncmp(args.at(1), "-ServerName:", 12) == 0)
+ if (args.count() >= 2 && args.at(1) && strncmp(args.at(1), "-ServerName:", 12) == 0)
args.remove(1);
bool develMode = false;
bool debugWait = false;
for (int i = args.count() - 1; i >= 0; --i) {
+ if (!args.at(i))
+ continue;
+
const char *arg = args.at(i);
if (strcmp(arg, "-qdevel") == 0) {
develMode = true;