diff --git a/editor/script/script_editor_plugin.cpp b/editor/script/script_editor_plugin.cpp index a5e97eece6d..f61abc0b9a4 100644 --- a/editor/script/script_editor_plugin.cpp +++ b/editor/script/script_editor_plugin.cpp @@ -738,25 +738,26 @@ void ScriptEditor::_go_to_tab(int p_idx) { c = tab_container->get_current_tab_control(); - if (Object::cast_to(c)) { - script_name_label->set_text(Object::cast_to(c)->get_name()); - script_icon->set_texture(Object::cast_to(c)->get_theme_icon()); + ScriptEditorBase *seb = Object::cast_to(c); + if (seb) { if (is_visible_in_tree()) { - Object::cast_to(c)->ensure_focus(); + seb->ensure_focus(); } - Ref