### 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?)
for (int i = 0; i < insert_data.size(); i++) {
		if (insert_data[i].type != Animation::TYPE_VALUE && insert_data[i].type != Animation::TYPE_BEZIER) {
			all_bezier = false;
		}
		if (insert_data[i].track_idx == -1) {
			++num_tracks;
			last_track_query = insert_data[i].query;
		}
		if (insert_data[i].type != Animation::TYPE_VALUE) {
			continue;
		}
		switch (insert_data[i].value.get_type()) {
			case Variant::INT:
			case Variant::FLOAT:
			case Variant::VECTOR2:
			case Variant::VECTOR3:
			case Variant::QUATERNION:
			case Variant::PLANE:
			case Variant::COLOR: {
				
			} break;
			default: {
				all_bezier = false;
			}
		}
	}
	if (bool(EDITOR_GET("editors/animation/confirm_insert_track")) && num_tracks > 0) {
		
		if (num_tracks == 1) {