From 26020c84ab10cd5c10b9a603b365d6107f1a5b21 Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Sun, 13 Aug 2017 16:34:27 +0200 Subject: updater: fix crash on windows while creating the updater command line Change-Id: I606f5ede0fe70af4b30c68a10b7c400612fddaee Reviewed-on: https://gerrit.libreoffice.org/41115 Reviewed-by: Markus Mohrhard Tested-by: Markus Mohrhard --- comphelper/source/windows/windows_process.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'comphelper') diff --git a/comphelper/source/windows/windows_process.cxx b/comphelper/source/windows/windows_process.cxx index 1c782d7a289f..b7fa19373dc2 100644 --- a/comphelper/source/windows/windows_process.cxx +++ b/comphelper/source/windows/windows_process.cxx @@ -135,7 +135,7 @@ MakeCommandLine(int argc, wchar_t **argv) int len = 0; // The + 1 of the last argument handles the allocation for null termination - for (i = 0; i < argc; ++i) + for (i = 0; i < argc && argv[i]; ++i) len += ArgStrLen(argv[i]) + 1; // Protect against callers that pass 0 arguments @@ -147,7 +147,7 @@ MakeCommandLine(int argc, wchar_t **argv) return nullptr; wchar_t *c = s; - for (i = 0; i < argc; ++i) + for (i = 0; i < argc && argv[i]; ++i) { c = ArgToString(c, argv[i]); if (i + 1 != argc) -- cgit