summaryrefslogtreecommitdiff
path: root/scene/main
diff options
context:
space:
mode:
authorkobewi <kobewi4e@gmail.com>2023-02-03 15:36:08 +0100
committerkobewi <kobewi4e@gmail.com>2023-02-03 15:36:08 +0100
commit7331750618d9dfcdd60a3405ccd301057b7461f9 (patch)
tree84cee4de6ddfee76f94a8151ef7989b35556ec1a /scene/main
parent1ed549e64b141e068bfe1a59bf65e943cde3fc6c (diff)
Fix Camera2D crash due to ParallaxBackground node
Diffstat (limited to 'scene/main')
-rw-r--r--scene/main/viewport.cpp4
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;