diff options
author | 2016-11-06 13:31:37 -0600 | |
---|---|---|
committer | 2016-11-06 13:31:37 -0600 | |
commit | 6fd9586a8966196857c8c36401215430b695ee93 (patch) | |
tree | fc666bd7bb042a81f2e0049a3d157dcd871f7a13 /3rdparty/sol2 | |
parent | 55b5777824df26af01139ba43f5d6722037dda92 (diff) |
make safe usertypes safer (nw)
Diffstat (limited to '3rdparty/sol2')
-rw-r--r-- | 3rdparty/sol2/sol/call.hpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/3rdparty/sol2/sol/call.hpp b/3rdparty/sol2/sol/call.hpp index 9f6a3af8c4c..b3e73ec4502 100644 --- a/3rdparty/sol2/sol/call.hpp +++ b/3rdparty/sol2/sol/call.hpp @@ -276,6 +276,9 @@ namespace sol { static int call(lua_State* L, Fx&& f) { typedef std::conditional_t<std::is_void<T>::value, object_type, T> Ta; #ifdef SOL_SAFE_USERTYPE + if(type_of(L, 1) != sol::type::userdata) { + return luaL_error(L, "sol: received null for 'self' argument (use ':' for accessing member functions, make sure member variables are preceeded by the actual object with '.' syntax)"); + } object_type* o = static_cast<object_type*>(stack::get<Ta*>(L, 1)); if (o == nullptr) { return luaL_error(L, "sol: received null for 'self' argument (use ':' for accessing member functions, make sure member variables are preceeded by the actual object with '.' syntax)"); |