瀏覽代碼

Merge pull request #110041 from Ivorforce/scene-tree-notification-no-root

Make `SceneTree` not crash when receiving a notification without a root being set
Thaddeus Crews 1 周之前
父節點
當前提交
b0da1c77e4
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      scene/main/scene_tree.cpp

+ 4 - 0
scene/main/scene_tree.cpp

@@ -897,6 +897,10 @@ void SceneTree::_main_window_focus_in() {
 }
 
 void SceneTree::_notification(int p_notification) {
+	if (!get_root()) {
+		return;
+	}
+
 	switch (p_notification) {
 		case NOTIFICATION_TRANSLATION_CHANGED: {
 			get_root()->propagate_notification(p_notification);