summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--source/ManualBindings.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/source/ManualBindings.cpp b/source/ManualBindings.cpp
index 39677b7a8..46ebfd4ae 100644
--- a/source/ManualBindings.cpp
+++ b/source/ManualBindings.cpp
@@ -392,6 +392,11 @@ static int FNNAME(lua_State * tolua_S) \
} \
\
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)) \
{ \