### Godot version

4.0.2

### System information

Windows 11

### Issue description

Changing node type from PopupMenu to ItemList causes Godot to crash

### Steps to reproduce

Change node type from PopupMenu to ItemList

### Minimal reproduction project

n/a
if (items[i].checkable_type) {
			has_check = true;
		}
	}
	if (icon_ofs > 0.0) {
		icon_ofs += theme_cache.h_separation;
	}
	float check_ofs = 0.0;
	if (has_check) {
		for (int i = 0; i < 4; i++) {
			check_ofs = MAX(check_ofs, check[i]->get_width());
			check_ofs = MAX(check_ofs, uncheck[i]->get_width());
		}
		check_ofs += theme_cache.h_separation;
	}
	Point2 ofs;
	
	for (int i = 0; i < items.size(); i++) {
		
		ofs.y += i > 0 ? theme_cache.v_separation : (float)theme_cache.v_separation / 2;
		_shape_item(i);
		Point2 item_ofs = ofs;
		Size2 icon_size = _get_item_icon_size(i);
		float h = _get_item_height(i);
		if (i == mouse_over) {
			if (rtl) {
				theme_cache.hover_style->draw(ci, Rect2(item_ofs + Point2(scroll_width, -theme_cache.v_separation / 2), Size2(display_width, h + theme_cache.v_separation)));
			} else {
				theme_cache.hover_style->draw(ci, Rect2(item_ofs + Point2(0, -theme_cache.v_separation / 2), Size2(display_width, h + theme_cache.v_separation)));
			}