summaryrefslogtreecommitdiff
path: root/comphelper/source/windows/windows_process.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'comphelper/source/windows/windows_process.cxx')
-rw-r--r--comphelper/source/windows/windows_process.cxx4
1 files changed, 2 insertions, 2 deletions
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)