diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-04-23 23:23:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-23 23:23:32 +0200 |
commit | 80f91c9d3664ab8dd226a3708e36886381e4508b (patch) | |
tree | 469eb41ed8faff76f0542a079eefb9d97b09f3c3 /editor | |
parent | 0453e6eddc07895d0683ea8534be531b50cb7cd0 (diff) | |
parent | 2fedd2559c405c57c224be035e739af8c1fc6810 (diff) |
Merge pull request #28351 from Paulb23/fix_state_crash
Fix crash when restoring script editor state
Diffstat (limited to 'editor')
-rw-r--r-- | editor/plugins/script_editor_plugin.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 5d81ade214..03287b8cf9 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -2507,19 +2507,25 @@ void ScriptEditor::set_window_layout(Ref<ConfigFile> p_layout) { if (!scr.is_valid()) { continue; } - edit(scr); + if (!edit(scr)) { + continue; + } } else { Error error; Ref<TextFile> text_file = _load_text_file(path, &error); if (error != OK || !text_file.is_valid()) { continue; } - edit(text_file); + if (!edit(text_file)) { + continue; + } } if (!script_info.empty()) { - ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(i)); - se->set_edit_state(script_info["state"]); + ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_child(tab_container->get_tab_count() - 1)); + if (se) { + se->set_edit_state(script_info["state"]); + } } } |