From f3302b80893708b66fe2cea8f8145c9a5fd6bd14 Mon Sep 17 00:00:00 2001 From: Adam Scott Date: Tue, 18 Jul 2023 20:36:40 -0400 Subject: [PATCH] Fix Camera2D crash when edited scene root is null (cherry picked from commit deb45c0cabc491d42d438de33f21da98f6d4bdbb) --- scene/2d/camera_2d.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp index 48445496aaa..e7003ab98bb 100644 --- a/scene/2d/camera_2d.cpp +++ b/scene/2d/camera_2d.cpp @@ -41,7 +41,7 @@ void Camera2D::_update_scroll() { if (Engine::get_singleton()->is_editor_hint()) { queue_redraw(); // 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; } }