diff options
author | Aaron Franke <arnfranke@yahoo.com> | 2023-08-02 00:03:28 -0500 |
---|---|---|
committer | Aaron Franke <arnfranke@yahoo.com> | 2023-09-03 11:40:48 -0500 |
commit | ff911c3ad3ee50aa375f2490b98df97637dd0268 (patch) | |
tree | 2846f6d2c0c469f3264682d02ac74a53bb9becd6 /editor/import_dock.cpp | |
parent | fa3428ff25bc577d2a3433090478a6d615567056 (diff) | |
download | redot-engine-ff911c3ad3ee50aa375f2490b98df97637dd0268.tar.gz |
Fix error message when reimporting resources with an empty scene open
Diffstat (limited to 'editor/import_dock.cpp')
-rw-r--r-- | editor/import_dock.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/editor/import_dock.cpp b/editor/import_dock.cpp index fcd2d8f908..018231cda5 100644 --- a/editor/import_dock.cpp +++ b/editor/import_dock.cpp @@ -543,8 +543,11 @@ void ImportDock::_reimport_and_cleanup() { Ref<Resource> old_res = old_resources[path]; Ref<Resource> new_res = ResourceLoader::load(path); - for (int j = 0; j < EditorNode::get_editor_data().get_edited_scene_count(); j++) { - _replace_resource_in_object(EditorNode::get_editor_data().get_edited_scene_root(j), old_res, new_res); + for (int i = 0; i < EditorNode::get_editor_data().get_edited_scene_count(); i++) { + Node *edited_scene_root = EditorNode::get_editor_data().get_edited_scene_root(i); + if (likely(edited_scene_root)) { + _replace_resource_in_object(edited_scene_root, old_res, new_res); + } } for (Ref<Resource> res : external_resources) { _replace_resource_in_object(res.ptr(), old_res, new_res); |