### Godot version

Godot 4.0 beta 16

### System information

Windows 10 education 21H2, mobile renderer

### Issue description

trying to open the animation tab on animatedsprite2d causes a crash. Can also happen with animatedsprite3d but not as consistently.

### Steps to reproduce

open a new project, make an animationplayer and animatedsprite2d the children of root. Make a new animation in the animationplayer and add a new spriteframe to the animatedsprite2d. With both the spriteframe and animation tabs open on the bottom panel click on animation. In a larger project this seems to cause a crash immediately (first noticed on a project with 11 animations and animatedsprite2d with 9 frames), on a new project repeatedly clicking on the animation tab will cause the crash. If first clicking on another tab such as audio and then animation the project will default to the spriteframe tab. 

Tested and occurs in beta 16 and 15 but not in 14. Seems to only happen sometimes when using animatedsprite3d instead of animatedsprite2d.

![image](https://user-images.githubusercontent.com/61514710/215531634-19fd4970-2d34-4bf1-b186-8f4384fbca8a.png)


### Minimal reproduction project

n/a
}
	}
	if (is_resource) {
		Resource *current_res = Object::cast_to<Resource>(current_obj);
		ERR_FAIL_COND(!current_res);
		InspectorDock::get_inspector_singleton()->edit(current_res);
		SceneTreeDock::get_singleton()->set_selected(nullptr);
		NodeDock::get_singleton()->set_node(nullptr);
		InspectorDock::get_singleton()->update(nullptr);
		ImportDock::get_singleton()->set_edit_path(current_res->get_path());
		int subr_idx = current_res->get_path().find("::");
		if (subr_idx != -1) {
			String base_path = current_res->get_path().substr(0, subr_idx);
			if (!base_path.is_resource_file()) {
				if (FileAccess::exists(base_path + ".import")) {
					if (get_edited_scene() && get_edited_scene()->get_scene_file_path() == base_path) {
						info_is_warning = true;
					}
					editable_info = TTR("This resource belongs to a scene that was imported, so it's not editable.\nPlease read the documentation relevant to importing scenes to better understand this workflow.");
				} else {
					if ((!get_edited_scene() || get_edited_scene()->get_scene_file_path() != base_path) && ResourceLoader::get_resource_type(base_path) == "PackedScene") {
						editable_info = TTR("This resource belongs to a scene that was instantiated or inherited.\nChanges to it must be made inside the original scene.");
					}
				}
			} else {
				if (FileAccess::exists(base_path + ".import")) {
					editable_info = TTR("This resource belongs to a scene that was imported, so it's not editable.\nPlease read the documentation relevant to importing scenes to better understand this workflow.");
				}
			}
		} else if (current_res->get_path().is_resource_file()) {