summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Giannangeli <giann008@gmail.com>2017-04-14 14:51:49 +0200
committerBenoit Giannangeli <giann008@gmail.com>2017-04-14 14:51:49 +0200
commitc40f6b898cc36a1f6e2359946b524e46982d70f2 (patch)
tree20a1293bcc0ea5f83dde48459e16cf3bc96eabdc
parent3d667b50989e31d18af0c235e28b68055adf62ff (diff)
downloadfengari-c40f6b898cc36a1f6e2359946b524e46982d70f2.tar.gz
fengari-c40f6b898cc36a1f6e2359946b524e46982d70f2.tar.bz2
fengari-c40f6b898cc36a1f6e2359946b524e46982d70f2.zip
Fixed l_str2int fail case
-rw-r--r--src/lobject.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lobject.js b/src/lobject.js
index cf3a52e..710a906 100644
--- a/src/lobject.js
+++ b/src/lobject.js
@@ -474,7 +474,7 @@ const l_str2int = function(s) {
while (ljstype.lisspace(s[0])) s = s.slice(1); /* skip trailing spaces */
- if (empty || s[0] !== 0) return null; /* something wrong in the numeral */
+ if (empty || (s.length > 0 && s[0] !== 0)) return null; /* something wrong in the numeral */
else {
return neg ? -a : a;
}