Skip to content

Commit

Permalink
Forbid object:attach(obj, ...) (#9762)
Browse files Browse the repository at this point in the history
Fixes #9761
  • Loading branch information
nerzhul committed Apr 27, 2020
1 parent be71e70 commit 91c4f7f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/script/lua_api/l_object.cpp
Expand Up @@ -674,8 +674,13 @@ int ObjectRef::l_set_attach(lua_State *L)
ServerActiveObject *parent = getobject(parent_ref);
if (co == NULL)
return 0;

if (parent == NULL)
return 0;

if (co == parent)
throw LuaError("ObjectRef::set_attach: attaching object to itself is not allowed.");

// Do it
int parent_id = 0;
std::string bone;
Expand Down

0 comments on commit 91c4f7f

Please sign in to comment.