Fix error when adding children to YSort

If it weren't for this warning, it would have crashed in release builds.
Fix #23889, fixup 6b8d6e3b07
This commit is contained in:
Bojidar Marinov 2018-12-04 21:11:40 +02:00
parent 9a8569d434
commit 02b569297e
No known key found for this signature in database
GPG Key ID: 4D546A8F1E091856
1 changed files with 3 additions and 3 deletions

View File

@ -339,7 +339,7 @@ void VisualServerCanvas::canvas_item_set_parent(RID p_item, RID p_parent) {
Item *ysort_owner = item_owner; Item *ysort_owner = item_owner;
while (ysort_owner && ysort_owner->sort_y) { while (ysort_owner && ysort_owner->sort_y) {
item_owner->ysort_children_count = -1; 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; Item *ysort_owner = item_owner;
while (ysort_owner && ysort_owner->sort_y) { while (ysort_owner && ysort_owner->sort_y) {
item_owner->ysort_children_count = -1; 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 { } else {
@ -1354,7 +1354,7 @@ bool VisualServerCanvas::free(RID p_rid) {
Item *ysort_owner = item_owner; Item *ysort_owner = item_owner;
while (ysort_owner && ysort_owner->sort_y) { while (ysort_owner && ysort_owner->sort_y) {
item_owner->ysort_children_count = -1; 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;
} }
} }
} }