From 13fd60572b3168f0e00a9cbff90c8d2faf329404 Mon Sep 17 00:00:00 2001 From: Eric M Date: Sun, 6 Sep 2020 13:59:40 +1000 Subject: Fixed get_usable_parent_rect() errors when initialising popup menus. --- scene/gui/popup_menu.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'scene') 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; -- cgit v1.2.3