浏览代码

perform_node_renames fix for a case where the new name is empty

Nikodem Lokatelj 7 年之前
父节点
当前提交
66d2cd3918
共有 1 个文件被更改,包括 7 次插入1 次删除
  1. 7 1
      editor/scene_tree_dock.cpp

+ 7 - 1
editor/scene_tree_dock.cpp

@@ -933,7 +933,13 @@ void SceneTreeDock::perform_node_renames(Node *p_base, List<Pair<NodePath, NodeP
 						NodePath root_path = p_base->get_path();
 
 						NodePath rel_path_old = root_path.rel_path_to(E->get().first);
-						NodePath rel_path_new = root_path.rel_path_to(E->get().second);
+
+						NodePath rel_path_new = E->get().second;
+
+						// if not empty, get new relative path
+						if (E->get().second != NodePath()) {
+							rel_path_new = root_path.rel_path_to(E->get().second);
+						}
 
 						// if old path detected, then it needs to be replaced with the new one
 						if (p == rel_path_old) {