浏览代码

Fix crash with empty scenes

kobewi 3 年之前
父节点
当前提交
d2c8741a69
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. 5 0
      editor/scene_tree_editor.cpp

+ 5 - 0
editor/scene_tree_editor.cpp

@@ -584,6 +584,11 @@ bool SceneTreeEditor::_update_filter(TreeItem *p_parent, bool p_scroll_to_select
 		p_parent = tree->get_root();
 	}
 
+	if (!p_parent) {
+		// Tree is empty, nothing to do here.
+		return false;
+	}
+
 	bool keep = false;
 	for (TreeItem *child = p_parent->get_first_child(); child; child = child->get_next()) {
 		keep = _update_filter(child, p_scroll_to_selected) || keep;