### 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
icon_color *= items[i].icon_modulate;
		
		item_ofs.x += theme_cache.item_start_padding;
		
		if (items[i].checkable_type && !items[i].separator) {
			int disabled = int(items[i].disabled) * 2;
			Texture2D *icon = (items[i].checked ? check[items[i].checkable_type - 1 + disabled] : uncheck[items[i].checkable_type - 1 + disabled]).ptr();
			if (rtl) {
				icon->draw(ci, Size2(control->get_size().width - item_ofs.x - icon->get_width(), item_ofs.y) + Point2(0, Math::floor((h - icon->get_height()) / 2.0)), icon_color);
			} else {
				icon->draw(ci, item_ofs + Point2(0, Math::floor((h - icon->get_height()) / 2.0)), icon_color);
			}
		}
		int separator_ofs = (display_width - items[i].text_buf->get_size().width) / 2;
		
		if (!items[i].icon.is_null()) {
			const Point2 icon_offset = Point2(0, Math::floor((h - icon_size.height) / 2.0));
			Point2 icon_pos;
			if (items[i].separator) {
				separator_ofs -= (icon_size.width + theme_cache.h_separation) / 2;
				if (rtl) {
					icon_pos = Size2(control->get_size().width - item_ofs.x - separator_ofs - icon_size.width, item_ofs.y);
				} else {
					icon_pos = item_ofs + Size2(separator_ofs, 0);
				}
			} else {
				if (rtl) {
					icon_pos = Size2(control->get_size().width - item_ofs.x - check_ofs - icon_size.width, item_ofs.y);
				} else {
					icon_pos = item_ofs + Size2(check_ofs, 0);