瀏覽代碼

Merge pull request #93974 from groud/fix_crash_editable_children_tilemaplayer

Fix crash in the TileMapLayer editor when using editable children
Rémi Verschelde 1 年之前
父節點
當前提交
fbe663940c
共有 1 個文件被更改,包括 9 次插入2 次删除
  1. 9 2
      editor/plugins/tiles/tile_map_layer_editor.cpp

+ 9 - 2
editor/plugins/tiles/tile_map_layer_editor.cpp

@@ -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 {
 	ERR_FAIL_COND(!p_current || !p_owner);
-	if (p_current != p_owner && p_current->get_owner() != p_owner) {
-		return;
+
+	if (p_current != p_owner) {
+		if (!p_current->get_owner()) {
+			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);
 	if (layer) {
 		r_list.append(layer);