Skip to content

Commit 351d38e

Browse files
moteusmattsta
authored andcommitted
Fix array detection when keys are strings
1 parent 8692d79 commit 351d38e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lua_cmsgpack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ static int table_is_an_array(lua_State *L) {
431431
lua_pop(L,1); /* Stack: ... key */
432432
/* The <= 0 check is valid here because we're comparing indexes. */
433433
#if LUA_VERSION_NUM < 503
434-
if (!lua_isnumber(L,-1) || (n = lua_tonumber(L, -1)) <= 0 ||
434+
if ((LUA_TNUMBER != lua_type(L,-1)) || (n = lua_tonumber(L, -1)) <= 0 ||
435435
!IS_INT_EQUIVALENT(n)) {
436436
#else
437437
if (!lua_isinteger(L,-1) || (n = lua_tointeger(L, -1)) <= 0) {

0 commit comments

Comments
 (0)