From 92d6e4909c5139503b45e16f262bad4bd3a4802f Mon Sep 17 00:00:00 2001 From: Ben Sorohan Date: Mon, 4 Dec 2017 12:36:03 +0100 Subject: [PATCH] Check if argv is set in array, instead of checking falsey --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 955f92907..e9caac060 100644 --- a/index.js +++ b/index.js @@ -747,7 +747,7 @@ Command.prototype.parseOptions = function(argv) { // If the next argument looks like it might be // an argument for this option, we pass it on. // If it isn't, then it'll simply be ignored - if (argv[i + 1] && argv[i + 1][0] !== '-') { + if ((i + 1) < argv.length && argv[i + 1][0] !== '-') { unknownOptions.push(argv[++i]); } continue;