summaryrefslogtreecommitdiff
path: root/servers
diff options
context:
space:
mode:
authorBojidar Marinov <bojidar.marinov.bg@gmail.com>2018-12-04 21:11:40 +0200
committerBojidar Marinov <bojidar.marinov.bg@gmail.com>2018-12-04 21:11:40 +0200
commit02b569297e309274eb5e0277d6fd031cd8a030b6 (patch)
tree131ece117548f4671d026caf2383717e4022c0ff /servers
parent9a8569d434107e721f5c7de0bf8ffe6471367d28 (diff)
Fix error when adding children to YSort
If it weren't for this warning, it would have crashed in release builds. Fix #23889, fixup 6b8d6e3b07c83da1c365f9ad79e84e5147ec26f7
Diffstat (limited to 'servers')
-rw-r--r--servers/visual/visual_server_canvas.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/servers/visual/visual_server_canvas.cpp b/servers/visual/visual_server_canvas.cpp
index 734c295a72..26fb3cc493 100644
--- a/servers/visual/visual_server_canvas.cpp
+++ b/servers/visual/visual_server_canvas.cpp
@@ -339,7 +339,7 @@ void VisualServerCanvas::canvas_item_set_parent(RID p_item, RID p_parent) {
Item *ysort_owner = item_owner;
while (ysort_owner && ysort_owner->sort_y) {
item_owner->ysort_children_count = -1;
- ysort_owner = canvas_item_owner.getornull(ysort_owner->parent);
+ ysort_owner = canvas_item_owner.owns(ysort_owner->parent) ? canvas_item_owner.getornull(ysort_owner->parent) : NULL;
}
}
@@ -363,7 +363,7 @@ void VisualServerCanvas::canvas_item_set_parent(RID p_item, RID p_parent) {
Item *ysort_owner = item_owner;
while (ysort_owner && ysort_owner->sort_y) {
item_owner->ysort_children_count = -1;
- ysort_owner = canvas_item_owner.getornull(ysort_owner->parent);
+ ysort_owner = canvas_item_owner.owns(ysort_owner->parent) ? canvas_item_owner.getornull(ysort_owner->parent) : NULL;
}
} else {
@@ -1354,7 +1354,7 @@ bool VisualServerCanvas::free(RID p_rid) {
Item *ysort_owner = item_owner;
while (ysort_owner && ysort_owner->sort_y) {
item_owner->ysort_children_count = -1;
- ysort_owner = canvas_item_owner.getornull(ysort_owner->parent);
+ ysort_owner = canvas_item_owner.owns(ysort_owner->parent) ? canvas_item_owner.getornull(ysort_owner->parent) : NULL;
}
}
}