From 88bec75f510149679bf5b824a6a19ffa84eed812 Mon Sep 17 00:00:00 2001 From: Ben Kelly Date: Sun, 22 Jan 2012 15:34:39 -0800 Subject: [PATCH] Convert NULL pointer to nil. Fixes #17 --- common/lqt_common.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/common/lqt_common.cpp b/common/lqt_common.cpp index db6f617..9c0d8db 100644 --- a/common/lqt_common.cpp +++ b/common/lqt_common.cpp @@ -438,6 +438,12 @@ void lqtL_unregister (lua_State *L, const void *p) { void lqtL_pushudata (lua_State *L, const void *p, const char *name) { bool already = false; + + if (p == NULL) { + lua_pushnil(L); // (1) + return; + } + lqtL_ensurepointer(L, p); // (1) if (lua_getmetatable(L, -1)) { // (2) -- 2.11.4.GIT