From 6bfb255401a1e459c99fde10bbf8e1d90647ff2f Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Sat, 27 May 2017 09:45:04 +0200 Subject: ltests.js: topointer cast lua_topointer result so null should be 0 --- tests/test-suite/ltests.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests') 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": { -- cgit v1.2.3-70-g09d2