summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBenoit Giannangeli <giann008@gmail.com>2017-05-10 15:03:12 +0200
committerBenoit Giannangeli <giann008@gmail.com>2017-05-10 15:03:12 +0200
commitb4e21e155a1fc3f0b46439859332c408e65ec67d (patch)
tree92f214fd59e94f1bbfa23e8dd99a781827442222 /src
parentbb7bd48b2ee90472a1353f996b355559f78a197a (diff)
downloadfengari-b4e21e155a1fc3f0b46439859332c408e65ec67d.tar.gz
fengari-b4e21e155a1fc3f0b46439859332c408e65ec67d.tar.bz2
fengari-b4e21e155a1fc3f0b46439859332c408e65ec67d.zip
Don't do recursive call of luaV_tointeger if luaO_str2num returns false
Diffstat (limited to 'src')
-rw-r--r--src/lvm.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lvm.js b/src/lvm.js
index 376e64e..8ca7b98 100644
--- a/src/lvm.js
+++ b/src/lvm.js
@@ -845,7 +845,8 @@ const luaV_tointeger = function(obj, mode) {
} else if (obj.ttisinteger()) {
return obj.value;
} else if (obj.ttisstring()) {
- return luaV_tointeger(lobject.luaO_str2num(obj.svalue()), mode);
+ let n = lobject.luaO_str2num(obj.svalue());
+ return n !== false ? luaV_tointeger(n, mode) : false;
}
return false;