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::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(stack::get(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)");