### Godot version

4.0.dev (c309de53997feff3286295fb2d71657f112a15db)

### System information

Linux, Nvidia, Vulkan

### Issue description

Editor segfaults when certain conditions are met when using the AnimationPlayer editor.

### Steps to reproduce

1. Create multiple animations, saved into a animation collection
2. Open an existing animation, then make a new empty animation
3. Change from seconds to fps, or add a new property to animate ()
4. Editor crashes

NOTE: It is slightly random and I have not found a perfect repro

### Minimal reproduction project

N/A (TBD?)
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
	undo_redo->create_action(TTR("Animation Move Keys"));
	List<_AnimMoveRestore> to_restore;
	float motion = moving_selection_offset;
	
	for (RBMap<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
		undo_redo->add_do_method(animation.ptr(), "track_remove_key", E->key().track, E->key().key);
	}
	
	for (RBMap<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
		float newtime = snap_time(E->get().pos + motion);
		int idx = animation->track_find_key(E->key().track, newtime, Animation::FIND_MODE_APPROX);
		if (idx == -1) {
			continue;
		}
		SelectedKey sk;
		sk.key = idx;