From 999a1fffec85628c7eb1cf2e9808bf7e0b44f26c Mon Sep 17 00:00:00 2001 From: Clement C Date: Mon, 8 May 2023 19:42:22 +0200 Subject: [PATCH] Fix crash when changing node type from PopMenu to ItemList --- scene/gui/popup_menu.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index 2e6c6dc4bd0..41025090ba1 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -2051,8 +2051,13 @@ bool PopupMenu::_get(const StringName &p_name, Variant &r_ret) const { r_ret = get_item_icon(item_index); return true; } else if (property == "checkable") { - r_ret = this->items[item_index].checkable_type; - return true; + if (item_index >= 0 && item_index < items.size()) { + r_ret = items[item_index].checkable_type; + return true; + } else { + r_ret = Item::CHECKABLE_TYPE_NONE; + ERR_FAIL_V(true); + } } else if (property == "checked") { r_ret = is_item_checked(item_index); return true;