diff --git a/stepmania/src/LuaBinding.h b/stepmania/src/LuaBinding.h index 485fcc8b92..2f27bade7e 100644 --- a/stepmania/src/LuaBinding.h +++ b/stepmania/src/LuaBinding.h @@ -155,7 +155,7 @@ public: void T::PushSelf( lua_State *L ) { Luna::PushObject( L, Luna::m_sClassName, this ); } \ static Luna##T registera##T; \ /* Call PushSelf, so we always call the derived Luna::Push. */ \ - namespace LuaHelpers { template<> void Push( lua_State *L, T *const &pObject ) { pObject->PushSelf( L ); } } + namespace LuaHelpers { template<> void Push( lua_State *L, T *const &pObject ) { if( pObject == NULL ) lua_pushnil(L); else pObject->PushSelf( L ); } } #define DEFINE_METHOD( method_name, expr ) \ static int method_name( T* p, lua_State *L ) { LuaHelpers::Push( L, p->expr ); return 1; }