summaryrefslogtreecommitdiff
path: root/tests/test-suite/ltests.js
diff options
context:
space:
mode:
authorBenoit Giannangeli <giann008@gmail.com>2017-05-27 09:45:04 +0200
committerBenoit Giannangeli <giann008@gmail.com>2017-05-27 09:45:04 +0200
commit6bfb255401a1e459c99fde10bbf8e1d90647ff2f (patch)
treee349f38161c74d25789f66ff6613f85083e016bd /tests/test-suite/ltests.js
parenta624b6d9c9ba44131ad91171dfa703d09777ace5 (diff)
downloadfengari-6bfb255401a1e459c99fde10bbf8e1d90647ff2f.tar.gz
fengari-6bfb255401a1e459c99fde10bbf8e1d90647ff2f.tar.bz2
fengari-6bfb255401a1e459c99fde10bbf8e1d90647ff2f.zip
ltests.js: topointer cast lua_topointer result so null should be 0
Diffstat (limited to 'tests/test-suite/ltests.js')
-rw-r--r--tests/test-suite/ltests.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/test-suite/ltests.js b/tests/test-suite/ltests.js
index 2fffa2f..8b79a48 100644
--- a/tests/test-suite/ltests.js
+++ b/tests/test-suite/ltests.js
@@ -440,7 +440,8 @@ const runJS = function(L, L1, pc) {
break;
}
case "topointer": {
- lua.lua_pushnumber(L1, lua.lua_topointer(L1, getindex(L, L1, pc)));
+ let p = lua.lua_topointer(L1, getindex(L, L1, pc));
+ lua.lua_pushnumber(L1, p !== null ? p : 0); /* in ltests.c, p is casted to a size_t so NULL gives 0 */
break;
}
case "tostring": {