### Godot version

master

### System information

PopOs 22.04, Nvidia

### Issue description

Under some conditions, adding a new animation to an AnimationFrame resource crashes the engine.
This happens only after restarting the engine, and trying to add a new animation on an AnimationFrame


https://github.com/godotengine/godot/assets/3624853/2586869b-bf0a-4840-a75a-f38f9c0bf649


Crash log : 

```
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.1.dev.custom_build (dc46163b121993229fedc7853000bd9bcb9ec2de)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] /lib/x86_64-linux-gnu/libc.so.6(+0x42520) [0x7f1e1f242520] (??:0)
[2] HashMap<StringName, SpriteFrames::Anim, HashMapHasherDefault, HashMapComparatorDefault<StringName>, DefaultTypedAllocator<HashMapElement<StringName, SpriteFrames::Anim> > >::_lookup_pos(StringName const&, unsigned int&) const (/Projects/godot/./core/templates/hash_map.h:100)
[3] HashMap<StringName, SpriteFrames::Anim, HashMapHasherDefault, HashMapComparatorDefault<StringName>, DefaultTypedAllocator<HashMapElement<StringName, SpriteFrames::Anim> > >::has(StringName const&) const (/Projects/godot/./core/templates/hash_map.h:310)
[4] SpriteFrames::has_animation(StringName const&) const (/Projects/godot/scene/resources/sprite_frames.cpp:106)
[5] SpriteFramesEditor::_animation_add() (/Projects/godot/editor/plugins/sprite_frames_editor_plugin.cpp:1001)
[6] void call_with_variant_args_helper<SpriteFramesEditor>(SpriteFramesEditor*, void (SpriteFramesEditor::*)(), Variant const**, Callable::CallError&, IndexSequence<>) (/Projects/godot/./core/variant/binder_common.h:308)
[7] void call_with_variant_args<SpriteFramesEditor>(SpriteFramesEditor*, void (SpriteFramesEditor::*)(), Variant const**, int, Callable::CallError&) (/Projects/godot/./core/variant/binder_common.h:418)
[8] CallableCustomMethodPointer<SpriteFramesEditor>::call(Variant const**, int, Variant&, Callable::CallError&) const (/Projects/godot/./core/object/callable_method_pointer.h:105)
[9] Callable::callp(Variant const**, int, Variant&, Callable::CallError&) const (/Projects/godot/core/variant/callable.cpp:51)
[10] Object::emit_signalp(StringName const&, Variant const**, int) (/Projects/godot/core/object/object.cpp:1068)
[11] Error Object::emit_signal<>(StringName const&) (/Projects/godot/./core/object/object.h:870)
[12] BaseButton::_pressed() (/Projects/godot/scene/gui/base_button.cpp:139)
[13] BaseButton::on_action_event(Ref<InputEvent>) (??:?)
[14] BaseButton::gui_input(Ref<InputEvent> const&) (/Projects/godot/scene/gui/base_button.cpp:69)
[15] Control::_call_gui_input(Ref<InputEvent> const&) (/Projects/godot/scene/gui/control.cpp:1752)
[16] Viewport::_gui_call_input(Control*, Ref<InputEvent> const&) (/Projects/godot/scene/main/viewport.cpp:1511)
[17] Viewport::_gui_input_event(Ref<InputEvent>) (/Projects/godot/scene/main/viewport.cpp:1781)
[18] Viewport::push_input(Ref<InputEvent> const&, bool) (/Projects/godot/scene/main/viewport.cpp:2944)
[19] Window::_window_input(Ref<InputEvent> const&) (/Projects/godot/scene/main/window.cpp:1389)
[20] void call_with_variant_args_helper<Window, Ref<InputEvent> const&, 0ul>(Window*, void (Window::*)(Ref<InputEvent> const&), Variant const**, Callable::CallError&, IndexSequence<0ul>) (/Projects/godot/./core/variant/binder_common.h:303)
[21] void call_with_variant_args<Window, Ref<InputEvent> const&>(Window*, void (Window::*)(Ref<InputEvent> const&), Variant const**, int, Callable::CallError&) (/Projects/godot/./core/variant/binder_common.h:418)
[22] CallableCustomMethodPointer<Window, Ref<InputEvent> const&>::call(Variant const**, int, Variant&, Callable::CallError&) const (/Projects/godot/./core/object/callable_method_pointer.h:105)
[23] Callable::callp(Variant const**, int, Variant&, Callable::CallError&) const (/Projects/godot/core/variant/callable.cpp:51)
[24] DisplayServerX11::_dispatch_input_event(Ref<InputEvent> const&) (/Projects/godot/platform/linuxbsd/x11/display_server_x11.cpp:3593)
[25] DisplayServerX11::_dispatch_input_events(Ref<InputEvent> const&) (/Projects/godot/platform/linuxbsd/x11/display_server_x11.cpp:3565)
[26] Input::_parse_input_event_impl(Ref<InputEvent> const&, bool) (/Projects/godot/core/input/input.cpp:705)
[27] Input::flush_buffered_events() (/Projects/godot/core/input/input.cpp:964)
[28] DisplayServerX11::process_events() (/Projects/godot/platform/linuxbsd/x11/display_server_x11.cpp:4661)
[29] OS_LinuxBSD::run() (/Projects/godot/platform/linuxbsd/os_linuxbsd.cpp:889)
[30] bin/godot.linuxbsd.editor.dev.x86_64.llvm(main+0x1fe) [0x55755e8189ae] (/Projects/godot/platform/linuxbsd/godot_linuxbsd.cpp:73)
[31] /lib/x86_64-linux-gnu/libc.so.6(+0x29d90) [0x7f1e1f229d90] (??:0)
[32] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80) [0x7f1e1f229e40] (??:0)
[33] bin/godot.linuxbsd.editor.dev.x86_64.llvm(_start+0x25) [0x55755e8186e5] (??:?)
-- END OF BACKTRACE --

```

### Steps to reproduce

Open the MRP, and click `Add Animation`

![2023-05-19_17-58](https://github.com/godotengine/godot/assets/3624853/68c41e03-eb6c-451e-8f69-9689eb3d6d55)


### Minimal reproduction project

[Godot4Test.zip](https://github.com/godotengine/godot/files/11518538/Godot4Test.zip)

String source_scene = get_edited_scene()->get_scene_file_path();
			if (FileAccess::exists(source_scene + ".import")) {
				editable_info = TTR("This scene was imported, so changes to it won't be kept.\nInstantiating or inheriting it will allow you to make changes to it.\nPlease read the documentation relevant to importing scenes to better understand this workflow.");
				info_is_warning = true;
			}
		}
	} else {
		Node *selected_node = nullptr;
		if (current_obj->is_class("EditorDebuggerRemoteObject")) {
			disable_folding = true;
		} else if (current_obj->is_class("MultiNodeEdit")) {
			Node *scene = get_edited_scene();
			if (scene) {
				MultiNodeEdit *multi_node_edit = Object::cast_to<MultiNodeEdit>(current_obj);
				int node_count = multi_node_edit->get_node_count();
				if (node_count > 0) {
					List<Node *> multi_nodes;
					for (int node_index = 0; node_index < node_count; ++node_index) {
						Node *node = scene->get_node(multi_node_edit->get_node(node_index));
						if (node) {
							multi_nodes.push_back(node);
						}
					}
					if (!multi_nodes.is_empty()) {
						
						multi_nodes.sort_custom<Node::Comparator>();
						selected_node = multi_nodes.front()->get();
					}
				}
			}