Просмотр исходного кода

#54143 Fix potential null pointer dereference

Bastien JAUNY 3 лет назад
Родитель
Сommit
e74db1de23
1 измененных файлов с 3 добавлено и 1 удалено
  1. 3 1
      scene/gui/tree.cpp

+ 3 - 1
scene/gui/tree.cpp

@@ -2795,7 +2795,9 @@ int Tree::_get_title_button_height() const {
 
 
 void Tree::_notification(int p_what) {
 void Tree::_notification(int p_what) {
 	if (p_what == NOTIFICATION_FOCUS_ENTER) {
 	if (p_what == NOTIFICATION_FOCUS_ENTER) {
-		focus_in_id = get_tree()->get_event_count();
+		if (get_tree()) {
+			focus_in_id = get_tree()->get_event_count();
+		}
 	}
 	}
 	if (p_what == NOTIFICATION_MOUSE_EXIT) {
 	if (p_what == NOTIFICATION_MOUSE_EXIT) {
 		if (cache.hover_type != Cache::CLICK_NONE) {
 		if (cache.hover_type != Cache::CLICK_NONE) {