Fix Camera2D crash when edited scene root is null

This commit is contained in:
Adam Scott 2023-07-18 20:36:40 -04:00
parent 8f175a8649
commit deb45c0cab
No known key found for this signature in database
GPG Key ID: 1352C2919D96DDDF
1 changed files with 1 additions and 1 deletions

View File

@ -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;
} }
} }