### 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?)
TreeItem *root_item = pick_track->get_scene_tree()->get_scene_tree()->get_root();
	Vector<Node *> select_candidates;
	Node *to_select = nullptr;
	String filter = pick_track->get_filter_line_edit()->get_text();
	_pick_track_select_recursive(root_item, filter, select_candidates);
	if (!select_candidates.is_empty()) {
		for (int i = 0; i < select_candidates.size(); ++i) {
			Node *candidate = select_candidates[i];
			if (((String)candidate->get_name()).to_lower().begins_with(filter.to_lower())) {
				to_select = candidate;
				break;
			}
		}
		if (!to_select) {
			to_select = select_candidates[0];
		}
	}
	pick_track->get_scene_tree()->set_selected(to_select);
}
void AnimationTrackEditor::_pick_track_select_recursive(TreeItem *p_item, const String &p_filter, Vector<Node *> &p_select_candidates) {