summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
}