mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-08 20:41:49 +00:00
fix infinite recursion on moveInto used to move to descendant node
This commit is contained in:
parent
f5de330f3f
commit
4f1411b005
3 changed files with 10 additions and 3 deletions
|
|
@ -165,6 +165,13 @@ static int l_container_set_interval(lua::State* L) {
|
|||
static int l_move_into(lua::State* L) {
|
||||
auto node = get_document_node(L, 1);
|
||||
auto dest = get_document_node(L, 2);
|
||||
if (dest.node == nullptr) {
|
||||
return 0;
|
||||
}
|
||||
if (dest.node->isDescendantOf(node.node.get())) {
|
||||
luaL_error(L, "unable to move element to its descendant");
|
||||
return 0;
|
||||
}
|
||||
UINode::moveInto(
|
||||
node.node, std::dynamic_pointer_cast<Container>(dest.node)
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue