summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThakee Nathees <thakeenathees@gmail.com>2020-03-05 16:12:41 +0530
committerThakee Nathees <thakeenathees@gmail.com>2020-03-05 18:19:58 +0530
commit3275e8488b59fb8a7a53c4edc0e6755b0ced782c (patch)
tree3ee07faa2fea4bcf08d60adda47fc3a9b88df759
parentf05bbe6932113b73efc57115a65b63ee8f626b8c (diff)
Fix EditorFolding crash when switching scenes
-rw-r--r--editor/editor_folding.cpp2
-rw-r--r--editor/editor_node.cpp2
2 files changed, 3 insertions, 1 deletions
diff --git a/editor/editor_folding.cpp b/editor/editor_folding.cpp
index 8308cd760b..507a77e641 100644
--- a/editor/editor_folding.cpp
+++ b/editor/editor_folding.cpp
@@ -133,6 +133,8 @@ void EditorFolding::_fill_folds(const Node *p_root, const Node *p_node, Array &p
}
void EditorFolding::save_scene_folding(const Node *p_scene, const String &p_path) {
+ ERR_FAIL_NULL(p_scene);
+
FileAccessRef file_check = FileAccess::create(FileAccess::ACCESS_RESOURCES);
if (!file_check->file_exists(p_path)) //This can happen when creating scene from FilesystemDock. It has path, but no file.
return;
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 6f8027ba64..43e640b40e 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -3279,7 +3279,7 @@ void EditorNode::_clear_undo_history() {
void EditorNode::set_current_scene(int p_idx) {
//Save the folding in case the scene gets reloaded.
- if (editor_data.get_scene_path(p_idx) != "")
+ if (editor_data.get_scene_path(p_idx) != "" && editor_data.get_edited_scene_root(p_idx))
editor_folding.save_scene_folding(editor_data.get_edited_scene_root(p_idx), editor_data.get_scene_path(p_idx));
if (editor_data.check_and_update_scene(p_idx)) {