Fix crash in the TileMapLayer editor when using editable children

This commit is contained in:
Gilles Roudière 2024-07-05 17:08:18 +02:00
parent c9ca3aa9ab
commit 8ebaf4437a

View File

@ -3630,9 +3630,16 @@ TileMapLayer *TileMapLayerEditor::_get_edited_layer() const {
void TileMapLayerEditor::_find_tile_map_layers_in_scene(Node *p_current, const Node *p_owner, Vector<TileMapLayer *> &r_list) const { void TileMapLayerEditor::_find_tile_map_layers_in_scene(Node *p_current, const Node *p_owner, Vector<TileMapLayer *> &r_list) const {
ERR_FAIL_COND(!p_current || !p_owner); ERR_FAIL_COND(!p_current || !p_owner);
if (p_current != p_owner && p_current->get_owner() != p_owner) {
if (p_current != p_owner) {
if (!p_current->get_owner()) {
return; return;
} }
if (p_current->get_owner() != p_owner && !p_owner->is_editable_instance(p_current->get_owner())) {
return;
}
}
TileMapLayer *layer = Object::cast_to<TileMapLayer>(p_current); TileMapLayer *layer = Object::cast_to<TileMapLayer>(p_current);
if (layer) { if (layer) {
r_list.append(layer); r_list.append(layer);