diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-09-06 10:05:40 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-06 10:05:40 +0200 |
commit | c6b044903dfc5146cbabb24b82d4d1e7465f18d2 (patch) | |
tree | b946667a5af45636fe73b842c961057c8589dcd6 /scene | |
parent | da588226a2b9caa3d8e4f5ecdbdad77bbbd3d96c (diff) | |
parent | 13fd60572b3168f0e00a9cbff90c8d2faf329404 (diff) |
Merge pull request #41801 from EricEzaM/PR/popup-menu-errors-fix
Fixed get_usable_parent_rect() errors when initialising popup menus.
Diffstat (limited to 'scene')
-rw-r--r-- | scene/gui/popup_menu.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index c9022e9844..2fdcf11ca8 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -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; |