summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorEric M <itsjusteza@gmail.com>2020-09-06 13:59:40 +1000
committerEric M <itsjusteza@gmail.com>2020-09-06 13:59:40 +1000
commit13fd60572b3168f0e00a9cbff90c8d2faf329404 (patch)
treec4abc538c30e74d9221d7e7c848e362de3461353 /scene
parent52f6ac81be14fe3f7dacb2e2b75d9bf9a668b628 (diff)
Fixed get_usable_parent_rect() errors when initialising popup menus.
Diffstat (limited to 'scene')
-rw-r--r--scene/gui/popup_menu.cpp8
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;