### Godot version

4.0.2

### System information

Windows 10,Radeon RX 550/550 Series,23.3.2,Vulkan

### Issue description

After Switching to the animations tabs and pressing the key symbol because I wanted to know what it does, Godot crashes

### Steps to reproduce

Go into a project 
Switch to the Animations Tab, make sure no animation is active 
And then press on the key symbol

here is a video demonstrating the bug

https://user-images.githubusercontent.com/59411880/233839816-5489899e-828f-4ac9-9de3-7914f727f754.mp4



### Minimal reproduction project

The File
[package.zip](https://github.com/godotengine/godot/files/11303712/package.zip)

Ref<InputEventMouseButton> b = p_event;
	Ref<InputEventMouseMotion> m = p_event;
	
	if (drag_type == DRAG_NONE) {
		if (b.is_valid() && b->get_button_index() == MouseButton::LEFT && b->is_pressed() && tool == TOOL_SELECT) {
			List<CanvasItem *> selection = _get_edited_canvas_items();
			if (selection.size() == 1) {
				CanvasItem *ci = selection[0];
				if (ci->_edit_use_rect() && _is_node_movable(ci)) {
					Rect2 rect = ci->_edit_get_rect();
					Transform2D xform = transform * ci->get_global_transform_with_canvas();
					const Vector2 endpoints[4] = {
						xform.xform(rect.position),
						xform.xform(rect.position + Vector2(rect.size.x, 0)),
						xform.xform(rect.position + rect.size),
						xform.xform(rect.position + Vector2(0, rect.size.y))
					};
					const DragType dragger[] = {
						DRAG_TOP_LEFT,
						DRAG_TOP,
						DRAG_TOP_RIGHT,
						DRAG_RIGHT,
						DRAG_BOTTOM_RIGHT,
						DRAG_BOTTOM,
						DRAG_BOTTOM_LEFT,
						DRAG_LEFT
					};
					DragType resize_drag = DRAG_NONE;