Fixed manual bindings' ForEachXXX mapping not checking the object instance for validity.

( http://forum.mc-server.org/showthread.php?tid=591&pid=5007#pid5007 )

git-svn-id: http://mc-server.googlecode.com/svn/trunk@996 0a769ca7-a7f5-676a-18bf-c427514a06d6
master
madmaxoft@gmail.com 2012-10-21 08:14:27 +00:00
parent 9f60f83ea7
commit 87b60df058
1 changed files with 5 additions and 0 deletions

View File

@ -392,6 +392,11 @@ static int FNNAME(lua_State * tolua_S) \
} \ } \
\ \
CONTAINER * self = (CONTAINER *) tolua_tousertype(tolua_S, 1, 0); \ CONTAINER * self = (CONTAINER *) tolua_tousertype(tolua_S, 1, 0); \
if (self == NULL) \
{ \
LOGWARN("Error in function call '" #FOREACH "': Not called on an object instance"); \
return 0; \
} \
\ \
if (!lua_isfunction( tolua_S, 2)) \ if (!lua_isfunction( tolua_S, 2)) \
{ \ { \