summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-11-12 08:38:43 +0100
committerGitHub <noreply@github.com>2019-11-12 08:38:43 +0100
commit88a8f9ab36f0523d602443134d3f88d7492b822e (patch)
tree4bf83c3eb607d9e7ab59a2e0a2ce5c9aa546af0a
parentba4c808721592a8558686b518d12f36e0fe60957 (diff)
parent47a4ca0022fe961d7dc607f37b0af6b5d0283d2e (diff)
Merge pull request #33557 from nekomatata/empty-tree-crash
Fixed crash when pressing down key on empty Tree
-rw-r--r--scene/gui/tree.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index a44b42a467..d479a1636a 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -2224,8 +2224,9 @@ void Tree::_go_down() {
TreeItem *next = NULL;
if (!selected_item) {
- next = hide_root ? root->get_next_visible() : root;
- selected_item = 0;
+ if (root) {
+ next = hide_root ? root->get_next_visible() : root;
+ }
} else {
next = selected_item->get_next_visible();