Check that there is actually an argument at that position before attempting to do something with it.

This commit is contained in:
Steve Checkoway
2008-12-26 08:50:47 +00:00
parent a0d35509d3
commit 1509d09ad4
3 changed files with 4 additions and 0 deletions
+2
View File
@@ -5,6 +5,8 @@
int CheckEnum( lua_State *L, LuaReference &table, int iPos, int iInvalid, const char *szType, bool bAllowInvalid ) int CheckEnum( lua_State *L, LuaReference &table, int iPos, int iInvalid, const char *szType, bool bAllowInvalid )
{ {
luaL_checkany( L, iPos );
if( lua_isnil(L, iPos) ) if( lua_isnil(L, iPos) )
{ {
if( bAllowInvalid ) if( bAllowInvalid )
+1
View File
@@ -226,6 +226,7 @@ bool LuaBinding::CheckLuaObjectType( lua_State *L, int iArg, const char *szType
#if defined(FAST_LUA) #if defined(FAST_LUA)
return true; return true;
#endif #endif
luaL_checkany( L, iArg );
/* Check that szType is in metatable.heirarchy. */ /* Check that szType is in metatable.heirarchy. */
if( !luaL_getmetafield(L, iArg, "heirarchy") ) if( !luaL_getmetafield(L, iArg, "heirarchy") )
+1
View File
@@ -190,6 +190,7 @@ inline bool MyLua_checkboolean (lua_State *L, int numArg)
* used to mean "cmd,false". */ * used to mean "cmd,false". */
inline bool MyLua_checkintboolean( lua_State *L, int iArg ) inline bool MyLua_checkintboolean( lua_State *L, int iArg )
{ {
luaL_checkany( L, iArg );
int iType = lua_type( L, iArg ); int iType = lua_type( L, iArg );
if( iType == LUA_TNUMBER ) if( iType == LUA_TNUMBER )
{ {