Do not access out of bounds arguments (#6792)

Potentially out of bounds arguments should not just be directly
accessed, instead use a ternary operator to check length.
This commit is contained in:
Anatoli Papirovski
2017-11-17 15:39:08 -05:00
committed by Nicolò Ribaudo
parent e67cfc5b31
commit 2b710d0387
5 changed files with 22 additions and 16 deletions

View File

@@ -5,6 +5,6 @@ var some = function () {
var collect = function () {
let since = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
let userid = arguments[1];
let userid = arguments.length > 1 ? arguments[1] : undefined;
console.log(userid);
};