### 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)

switch (p_option) {
		case RUN_FILE_SERVER: {
			bool ischecked = debug_menu->is_item_checked(debug_menu->get_item_index(RUN_FILE_SERVER));
			if (ischecked) {
				file_server->stop();
				set_process(false);
			} else {
				file_server->start();
				set_process(true);
			}
			debug_menu->set_item_checked(debug_menu->get_item_index(RUN_FILE_SERVER), !ischecked);
			EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_file_server", !ischecked);
		} break;
		case RUN_LIVE_DEBUG: {
			bool ischecked = debug_menu->is_item_checked(debug_menu->get_item_index(RUN_LIVE_DEBUG));
			debug_menu->set_item_checked(debug_menu->get_item_index(RUN_LIVE_DEBUG), !ischecked);
			EditorDebuggerNode::get_singleton()->set_live_debugging(!ischecked);
			EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_live_debug", !ischecked);
		} break;
		case RUN_DEPLOY_REMOTE_DEBUG: {
			bool ischecked = debug_menu->is_item_checked(debug_menu->get_item_index(RUN_DEPLOY_REMOTE_DEBUG));
			debug_menu->set_item_checked(debug_menu->get_item_index(RUN_DEPLOY_REMOTE_DEBUG), !ischecked);
			EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_deploy_remote_debug", !ischecked);
		} break;
		case RUN_DEBUG_COLLISIONS: {
			bool ischecked = debug_menu->is_item_checked(debug_menu->get_item_index(RUN_DEBUG_COLLISIONS));
			debug_menu->set_item_checked(debug_menu->get_item_index(RUN_DEBUG_COLLISIONS), !ischecked);
			EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_debug_collisions", !ischecked);
		} break;