### Godot version

Godot Engine v4.0.beta16.official.518b9e580

### System information

Linux, Vulkan, nvidia RTX 2070, Driver 525.60.11

### Issue description

Editor crashes when changing between theme editor and animation editor

Console:
`ERROR: Condition "slot >= slot_max" is true. Returning: nullptr
   at: get_instance (./core/object/object.h:962)
ERROR: Condition "slot >= slot_max" is true. Returning: nullptr
   at: get_instance (./core/object/object.h:962)

================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.0.beta16.official (518b9e5801a19229805fe837d7d0cf92920ad413)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] /lib/x86_64-linux-gnu/libc.so.6(+0x42520) [0x7f908134c520] (??:0)
[2] /home/solorvox/GameDev/godot-engine/Godot_v4.0-beta16_linux.x86_64() [0x1c6d494] (??:0)
[3] /home/solorvox/GameDev/godot-engine/Godot_v4.0-beta16_linux.x86_64() [0x1c4eefe] (??:0)
[4] /home/solorvox/GameDev/godot-engine/Godot_v4.0-beta16_linux.x86_64() [0x44fb21a] (??:0)
[5] /home/solorvox/GameDev/godot-engine/Godot_v4.0-beta16_linux.x86_64() [0x26faf8b] (??:0)
[6] /home/solorvox/GameDev/godot-engine/Godot_v4.0-beta16_linux.x86_64() [0x448c994] (??:0)
[7] /home/solorvox/GameDev/godot-engine/Godot_v4.0-beta16_linux.x86_64() [0x2a9eb11] (??:0)
[8] /home/solorvox/GameDev/godot-engine/Godot_v4.0-beta16_linux.x86_64() [0x2a9eb8f] (??:0)
[9] /home/solorvox/GameDev/godot-engine/Godot_v4.0-beta16_linux.x86_64() [0x1c65ae0] (??:0)
[10] /home/solorvox/GameDev/godot-engine/Godot_v4.0-beta16_linux.x86_64() [0x42e50c2] (??:0)
[11] /home/solorvox/GameDev/godot-engine/Godot_v4.0-beta16_linux.x86_64() [0x44fb21a] (??:0)
[12] /home/solorvox/GameDev/godot-engine/Godot_v4.0-beta16_linux.x86_64() [0x2bcf06f] (??:0)
[13] /home/solorvox/GameDev/godot-engine/Godot_v4.0-beta16_linux.x86_64() [0x2bcfa7e] (??:0)
[14] /home/solorvox/GameDev/godot-engine/Godot_v4.0-beta16_linux.x86_64() [0x2b30f15] (??:0)
[15] /home/solorvox/GameDev/godot-engine/Godot_v4.0-beta16_linux.x86_64() [0x2b817d5] (??:0)
[16] /home/solorvox/GameDev/godot-engine/Godot_v4.0-beta16_linux.x86_64() [0x2b85781] (??:0)
[17] /home/solorvox/GameDev/godot-engine/Godot_v4.0-beta16_linux.x86_64() [0x2b85deb] (??:0)
[18] /home/solorvox/GameDev/godot-engine/Godot_v4.0-beta16_linux.x86_64() [0x2ba1cf5] (??:0)
[19] /home/solorvox/GameDev/godot-engine/Godot_v4.0-beta16_linux.x86_64() [0xe69114] (??:0)
[20] /home/solorvox/GameDev/godot-engine/Godot_v4.0-beta16_linux.x86_64() [0x42d5f34] (??:0)
[21] /home/solorvox/GameDev/godot-engine/Godot_v4.0-beta16_linux.x86_64() [0x42d6db5] (??:0)
[22] /home/solorvox/GameDev/godot-engine/Godot_v4.0-beta16_linux.x86_64() [0xe6ab2d] (??:0)
[23] /home/solorvox/GameDev/godot-engine/Godot_v4.0-beta16_linux.x86_64() [0xddd7c2] (??:0)
[24] /lib/x86_64-linux-gnu/libc.so.6(+0x29d90) [0x7f9081333d90] (??:0)
[25] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80) [0x7f9081333e40] (??:0)
[26] /home/solorvox/GameDev/godot-engine/Godot_v4.0-beta16_linux.x86_64() [0xdfd8ee] (??:0)
-- END OF BACKTRACE --
================================================================`


### Steps to reproduce

Open included project
1) Click on AnimationPlayer in scene tree
2) Click on TextureRect in scene tree
4) Click on "Theme" editor at bottom of editor window (theme editor opens)
5) Click on "Animation" editor at bottom (crash)

Notes: The shader source code must be open, and a theme must be open to repeat this crash

### Minimal reproduction project

[animation-crash.zip](https://github.com/godotengine/godot/files/10530646/animation-crash.zip)

void _open_imported();
	void _save_default_environment();
	void _update_update_spinner();
	void _resources_changed(const Vector<String> &p_resources);
	void _scan_external_changes();
	void _reload_modified_scenes();
	void _reload_project_settings();
	void _resave_scenes(String p_str);
	void _feature_profile_changed();
	bool _is_class_editor_disabled_by_feature_profile(const StringName &p_class);
	Ref<ImageTexture> _load_custom_class_icon(const String &p_path) const;
	void _pick_main_scene_custom_action(const String &p_custom_action_name);
	void _immediate_dialog_confirmed();
	void _select_default_main_screen_plugin();
	void _bottom_panel_switch(bool p_enable, int p_idx);
	void _bottom_panel_raise_toggled(bool);
	void _begin_first_scan();
	bool use_startup_benchmark = false;
	String startup_benchmark_file;
protected:
	friend class FileSystemDock;
	static void _bind_methods();
	void _notification(int p_what);
	int get_current_tab();
	void set_current_tab(int p_tab);
public:
	
	void _on_plugin_ready(Object *p_script, const String &p_activate_name);
	void editor_select(int p_which);
	void set_visible_editor(EditorTable p_table) { editor_select(p_table); }