Merge pull request #41801 from EricEzaM/PR/popup-menu-errors-fix

Fixed get_usable_parent_rect() errors when initialising popup menus.
This commit is contained in:
Rémi Verschelde 2020-09-06 10:05:40 +02:00 committed by GitHub
commit c6b044903d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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;