### 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
parent_rect = p_rect;
}
void PopupMenu::add_autohide_area(const Rect2 &p_area) {
	autohide_areas.push_back(p_area);
}
void PopupMenu::clear_autohide_areas() {
	autohide_areas.clear();
}
void PopupMenu::take_mouse_focus() {
	ERR_FAIL_COND(!is_inside_tree());
	if (get_parent()) {
		get_parent()->get_viewport()->pass_mouse_focus_to(this, control);
	}
}
bool PopupMenu::_set(const StringName &p_name, const Variant &p_value) {
	Vector<String> components = String(p_name).split("/", true, 2);
	if (components.size() >= 2 && components[0].begins_with("item_") && components[0].trim_prefix("item_").is_valid_int()) {
		int item_index = components[0].trim_prefix("item_").to_int();
		String property = components[1];
		if (property == "text") {
			set_item_text(item_index, p_value);
			return true;
		} else if (property == "icon") {
			set_item_icon(item_index, p_value);
			return true;
		} else if (property == "checkable") {
			bool radio_checkable = (int)p_value == Item::CHECKABLE_TYPE_RADIO_BUTTON;
			if (radio_checkable) {
				set_item_as_radio_checkable(item_index, true);
			} else {