Fixed get_usable_parent_rect() errors when initialising popup menus.

This commit is contained in:
Eric M 2020-09-06 13:59:40 +10:00
parent 52f6ac81be
commit 13fd60572b

View file

@ -101,9 +101,11 @@ Size2 PopupMenu::_get_contents_minimum_size() const {
minsize.width += check_w;
}
int height_limit = get_usable_parent_rect().size.height;
if (minsize.height > height_limit) {
minsize.height = height_limit;
if (is_inside_tree()) {
int height_limit = get_usable_parent_rect().size.height;
if (minsize.height > height_limit) {
minsize.height = height_limit;
}
}
return minsize;