### 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 _version_button_pressed();
	void _update_undo_redo_allowed();
	int _save_external_resources();
	bool _validate_scene_recursive(const String &p_filename, Node *p_node);
	void _save_scene(String p_file, int idx = -1);
	void _save_all_scenes();
	int _next_unsaved_scene(bool p_valid_filename, int p_start = 0);
	void _discard_changes(const String &p_str = String());
	void _inherit_request(String p_file);
	void _instantiate_request(const Vector<String> &p_files);
	void _quick_opened();
	void _quick_run();
	void _open_command_palette();
	void _write_movie_toggled(bool p_enabled);
	void _run(bool p_current = false, const String &p_custom = "");
	void _run_native(const Ref<EditorExportPreset> &p_preset);
	void _reset_play_buttons();
	void _add_to_recent_scenes(const String &p_scene);
	void _update_recent_scenes();
	void _open_recent_scene(int p_idx);
	void _global_menu_scene(const Variant &p_tag);
	void _global_menu_new_window(const Variant &p_tag);
	void _dropped_files(const Vector<String> &p_files);
	void _add_dropped_files_recursive(const Vector<String> &p_files, String to_path);
	void _update_from_settings();
	void _renderer_selected(int);
	void _update_renderer_color();
	void _exit_editor(int p_exit_code);
	virtual void shortcut_input(const Ref<InputEvent> &p_event) override;
	bool has_main_screen() const { return true; }