projects
/
oweals
/
minetest.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
be71e70
)
Forbid object:attach(obj, ...) (#9762)
author
Loïc Blot
<nerzhul@users.noreply.github.com>
Mon, 27 Apr 2020 09:27:27 +0000
(11:27 +0200)
committer
GitHub
<noreply@github.com>
Mon, 27 Apr 2020 09:27:27 +0000
(11:27 +0200)
Fixes #9761
src/script/lua_api/l_object.cpp
patch
|
blob
|
history
diff --git
a/src/script/lua_api/l_object.cpp
b/src/script/lua_api/l_object.cpp
index d7afb84da6e11a219e0ff467f45595436d5c812a..77e1e7dc2b44ebae5a8ae140b7922d63214945e8 100644
(file)
--- a/
src/script/lua_api/l_object.cpp
+++ b/
src/script/lua_api/l_object.cpp
@@
-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;