### 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?)
float scale = timeline->get_zoom_scale();
				int limit_end = get_size().width - timeline->get_buttons_width();
				for (int i = 0; i < animation->track_get_key_count(track); i++) {
					float offset = animation->track_get_key_time(track, i) - timeline->get_value();
					if (editor->is_key_selected(track, i) && editor->is_moving_selection()) {
						offset = editor->snap_time(offset + editor->get_moving_selection_offset(), true);
					}
					offset = offset * scale + limit;
					if (i < animation->track_get_key_count(track) - 1) {
						float offset_n = animation->track_get_key_time(track, i + 1) - timeline->get_value();
						if (editor->is_key_selected(track, i + 1) && editor->is_moving_selection()) {
							offset_n = editor->snap_time(offset_n + editor->get_moving_selection_offset());
						}
						offset_n = offset_n * scale + limit;
						draw_key_link(i, scale, int(offset), int(offset_n), limit, limit_end);
					}
					draw_key(i, scale, int(offset), editor->is_key_selected(track, i), limit, limit_end);
				}
			}
			draw_fg(limit, get_size().width - timeline->get_buttons_width());
			
			{
				Ref<Texture2D> wrap_icon[2] = {
					get_theme_icon(SNAME("InterpWrapClamp"), SNAME("EditorIcons")),
					get_theme_icon(SNAME("InterpWrapLoop"), SNAME("EditorIcons")),
				};
				Ref<Texture2D> interp_icon[5] = {
					get_theme_icon(SNAME("InterpRaw"), SNAME("EditorIcons")),
					get_theme_icon(SNAME("InterpLinear"), SNAME("EditorIcons")),
					get_theme_icon(SNAME("InterpCubic"), SNAME("EditorIcons")),