Browse Source

Merge pull request #79645 from adamscott/fix-camera-2d-editor

Fix Camera2D crash when edited scene root is null
Yuri Sizov 2 years ago
parent
commit
7a313318b2
1 changed files with 1 additions and 1 deletions
  1. 1 1
      scene/2d/camera_2d.cpp

+ 1 - 1
scene/2d/camera_2d.cpp

@@ -41,7 +41,7 @@ void Camera2D::_update_scroll() {
 	if (Engine::get_singleton()->is_editor_hint()) {
 	if (Engine::get_singleton()->is_editor_hint()) {
 		queue_redraw();
 		queue_redraw();
 		// Only set viewport transform when not bound to the main viewport.
 		// Only set viewport transform when not bound to the main viewport.
-		if (get_viewport() == get_tree()->get_edited_scene_root()->get_viewport()) {
+		if (get_tree()->get_edited_scene_root() && get_viewport() == get_tree()->get_edited_scene_root()->get_viewport()) {
 			return;
 			return;
 		}
 		}
 	}
 	}