### Godot version

4.1 beta2

### System information

Windows 10 Home

### Issue description

I had a control with a custom theme which i removed. When loading the project again the Theme Editor is opened and some actions, like Show Default or Override All, cause the editor to crash.

### Steps to reproduce

1. create a scene with a Control node
2. add a custom theme to it
3. click the theme so the Theme Editor opens
4. remove the theme
5. save the scene
6. close the project and open it again (Theme Editor needs to be opened when closing the project)
7. click Show Default or Override All

### Minimal reproduction project

[Godot41_themeEditorCrash.zip](https://github.com/godotengine/godot/files/11760454/Godot41_themeEditorCrash.zip)

Ref<Script> get_object_custom_type_base(const Object *p_object) const;
	StringName get_object_custom_type_name(const Object *p_object) const;
	Ref<Texture2D> get_object_icon(const Object *p_object, const String &p_fallback = "Object");
	Ref<Texture2D> get_class_icon(const String &p_class, const String &p_fallback = "Object");
	bool is_object_of_custom_type(const Object *p_object, const StringName &p_class);
	void show_accept(const String &p_text, const String &p_title);
	void show_save_accept(const String &p_text, const String &p_title);
	void show_warning(const String &p_text, const String &p_title = TTR("Warning!"));
	void _copy_warning(const String &p_str);
	Error export_preset(const String &p_preset, const String &p_path, bool p_debug, bool p_pack_only);
	Control *get_gui_base() { return gui_base; }
	Control *get_theme_base() { return gui_base->get_parent_control(); }
	void save_scene_to_path(String p_file, bool p_with_preview = true) {
		if (p_with_preview) {
			_save_scene_with_preview(p_file);
		} else {
			_save_scene(p_file);
		}
	}
	bool is_scene_in_use(const String &p_path);
	void save_editor_layout_delayed();
	void save_default_environment();
	void open_export_template_manager();
	void reload_scene(const String &p_path);
	void find_all_instances_inheriting_path_in_node(Node *p_root, Node *p_node, const String &p_instance_path, List<Node *> &p_instance_list);
	void reload_instances_with_path_in_edited_scenes(const String &p_path);
	bool is_exiting() const { return exiting; }