### Godot version

3.5.1mono

### System information

windows10

### Issue description

Error message
 scene/main/node.cpp:1362 - Index p_index = 0 is out of bounds (data.children.size() = 0).
 scene/main/node.cpp:397 - Parameter "p_child" is null.
 scene/gui/tab_container.cpp:593 - Index p_current = 0 is out of bounds (get_tab_count() = 0).
See "Steps to reproduce for details"

### Steps to reproduce

Set an external text editor
Create a script
Drop the script to the built-in text editor like this image:
![image](https://user-images.githubusercontent.com/119792950/209504041-039f2620-5e42-4c0f-8c41-cd24486fb3d2.png)
And got error message:
 scene/main/node.cpp:1362 - Index p_index = 0 is out of bounds (data.children.size() = 0).
 scene/main/node.cpp:397 - Parameter "p_child" is null.
 scene/gui/tab_container.cpp:593 - Index p_current = 0 is out of bounds (get_tab_count() = 0).

### Minimal reproduction project

An empty project
String end = string.get_slice_count(" ") > 1 ? string.get_slice(" ", 1) : String();
			highlighter->add_color_region(beg, end, string_color, end.is_empty());
		}
	}
}
Ref<EditorSyntaxHighlighter> EditorStandardSyntaxHighlighter::_create() const {
	Ref<EditorStandardSyntaxHighlighter> syntax_highlighter;
	syntax_highlighter.instantiate();
	return syntax_highlighter;
}
Ref<EditorSyntaxHighlighter> EditorPlainTextSyntaxHighlighter::_create() const {
	Ref<EditorPlainTextSyntaxHighlighter> syntax_highlighter;
	syntax_highlighter.instantiate();
	return syntax_highlighter;
}
void ScriptEditorBase::_bind_methods() {
	ClassDB::bind_method(D_METHOD("get_base_editor"), &ScriptEditorBase::get_base_editor);
	ClassDB::bind_method(D_METHOD("add_syntax_highlighter", "highlighter"), &ScriptEditorBase::add_syntax_highlighter);
	ADD_SIGNAL(MethodInfo("name_changed"));
	ADD_SIGNAL(MethodInfo("edited_script_changed"));
	ADD_SIGNAL(MethodInfo("request_help", PropertyInfo(Variant::STRING, "topic")));
	ADD_SIGNAL(MethodInfo("request_open_script_at_line", PropertyInfo(Variant::OBJECT, "script"), PropertyInfo(Variant::INT, "line")));
	ADD_SIGNAL(MethodInfo("request_save_history"));
	ADD_SIGNAL(MethodInfo("go_to_help", PropertyInfo(Variant::STRING, "what")));
	
	ADD_SIGNAL(MethodInfo("search_in_files_requested", PropertyInfo(Variant::STRING, "text")));
	ADD_SIGNAL(MethodInfo("replace_in_files_requested", PropertyInfo(Variant::STRING, "text")));
	ADD_SIGNAL(MethodInfo("go_to_method", PropertyInfo(Variant::OBJECT, "script"), PropertyInfo(Variant::STRING, "method")));
}
class EditorScriptCodeCompletionCache : public ScriptCodeCompletionCache {