summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Arys <robin@blueoniongames.com>2021-10-23 10:38:52 +0200
committerRobin Arys <robin@blueoniongames.com>2021-10-23 12:02:09 +0200
commit5c25497aa239a0ffa8f367327f124871b001384b (patch)
tree089158d0068b817b82cbfd2ba43ff688c4c2084b
parentf1f51f5d4b2a4cdf9668fb90387c5d062f2a548b (diff)
Fix possible crash when calling Tree.notification from _ready
-rw-r--r--scene/gui/tree.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index 3f041bf65a..992d364464 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -3570,7 +3570,9 @@ int Tree::_get_title_button_height() const {
void Tree::_notification(int p_what) {
if (p_what == NOTIFICATION_FOCUS_ENTER) {
- focus_in_id = get_viewport()->get_processed_events_count();
+ if (get_viewport()) {
+ focus_in_id = get_viewport()->get_processed_events_count();
+ }
}
if (p_what == NOTIFICATION_MOUSE_EXIT) {
if (cache.hover_type != Cache::CLICK_NONE) {