### Godot version

v4.0.stable.official [92bee43ad]

### System information

Windows 10, 64bit

### Issue description

First, please run the reproduction project.
When I run the test scene, It report error like follow and app exited. 
![image](https://user-images.githubusercontent.com/35988767/229076194-f737bcb6-6c9b-4aa0-9bd5-3dbd36bc8d03.png)
And I don't know where was error.



### Steps to reproduce

1. Open the reproduction project.
2. Open scene 'user:\\xd\XActors\Weapon\Gun\Rifle\XRifle.tscn'
3. Assign the scene's Meshinstance's mesh with 'user:\\xd\XActors\Weapon\Gun\Rifle\XRifle01.res'
4. Run the scene
Opps, the scene exited.
![GIF](https://user-images.githubusercontent.com/35988767/229077075-4b18b9e0-933e-47f6-b6a8-0af966574884.gif)


### Minimal reproduction project

[GlbTest.zip](https://github.com/godotengine/godot/files/11120181/GlbTest.zip)

NOTE: The project that I provided was picked up from my owner project. Sorry I can't provide a minimal reproduction project because I don't know which step cause this issue. I was test like this:
Create a project, import the glb file, create meshinstance and assign mesh, but there was not error!

update_script_mutex.lock();
	for (const String &path : update_script_paths) {
		ScriptServer::remove_global_class_by_path(path); 
		int index = -1;
		EditorFileSystemDirectory *efd = find_file(path, &index);
		if (!efd || index < 0) {
			
			continue;
		}
		if (!efd->files[index]->script_class_name.is_empty()) {
			String lang;
			for (int j = 0; j < ScriptServer::get_language_count(); j++) {
				if (ScriptServer::get_language(j)->handles_global_class_type(efd->files[index]->type)) {
					lang = ScriptServer::get_language(j)->get_name();
				}
			}
			if (lang.is_empty()) {
				continue; 
			}
			ScriptServer::add_global_class(efd->files[index]->script_class_name, efd->files[index]->script_class_extends, lang, path);
			EditorNode::get_editor_data().script_class_set_icon_path(efd->files[index]->script_class_name, efd->files[index]->script_class_icon_path);
			EditorNode::get_editor_data().script_class_set_name(path, efd->files[index]->script_class_name);
		}
	}
	
	for (const String &path : update_script_paths) {
		int index = -1;
		EditorFileSystemDirectory *efd = find_file(path, &index);
		if (!efd || index < 0) {