diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2023-02-03 15:45:33 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-02-03 15:45:33 +0100 |
commit | ecbf087324ce2621fc611a193245e7b0baf9660c (patch) | |
tree | 670e70b1d37576edf2c04b5db572bff0b760cc2b /scene | |
parent | c09445de2afff3b0e4649359bc8770cf445b9790 (diff) | |
parent | 7331750618d9dfcdd60a3405ccd301057b7461f9 (diff) |
Merge pull request #72665 from KoBeWi/sneaky_ParallaxBackground_destroys_the_world
Fix Camera2D crash due to ParallaxBackground node
Diffstat (limited to 'scene')
-rw-r--r-- | scene/main/viewport.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 19d16ae27e..28521c5bbe 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -1062,6 +1062,10 @@ void Viewport::assign_next_enabled_camera_2d(const StringName &p_camera_group) { Camera2D *new_camera = nullptr; for (Node *E : camera_list) { Camera2D *cam = Object::cast_to<Camera2D>(E); + if (!cam) { + continue; // Non-camera node (e.g. ParallaxBackground). + } + if (cam->is_enabled()) { new_camera = cam; break; |