### 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 prop_name = E.name;
				if (E.usage & PROPERTY_USAGE_CATEGORY || E.usage & PROPERTY_USAGE_GROUP || E.usage & PROPERTY_USAGE_SUBGROUP) {
					continue;
				}
				if (prop_name.contains("/")) {
					continue;
				}
				highlighter->add_member_keyword_color(prop_name, member_variable_color);
			}
			List<String> clist;
			ClassDB::get_integer_constant_list(instance_base, &clist);
			for (const String &E : clist) {
				highlighter->add_member_keyword_color(E, member_variable_color);
			}
		}
		
		const Color comment_color = EDITOR_GET("text_editor/theme/highlighting/comment_color");
		List<String> comments;
		scr->get_language()->get_comment_delimiters(&comments);
		for (const String &comment : comments) {
			String beg = comment.get_slice(" ", 0);
			String end = comment.get_slice_count(" ") > 1 ? comment.get_slice(" ", 1) : String();
			highlighter->add_color_region(beg, end, comment_color, end.is_empty());
		}
		
		const Color string_color = EDITOR_GET("text_editor/theme/highlighting/string_color");
		List<String> strings;
		scr->get_language()->get_string_delimiters(&strings);
		for (const String &string : strings) {
			String beg = string.get_slice(" ", 0);