summaryrefslogtreecommitdiff
path: root/scene/main
diff options
context:
space:
mode:
authorkobewi <kobewi4e@gmail.com>2023-02-01 23:32:13 +0100
committerkobewi <kobewi4e@gmail.com>2023-02-01 23:49:02 +0100
commit724d6581d64d3b8e99dae0bb1011edef8fbf700e (patch)
tree4e24c00029ccbb204e4604c3789bff947a786e26 /scene/main
parent0a9e6e478e3183d7bf3c5cb895c706bc6275d3ea (diff)
Fix Camera2D crashes
Diffstat (limited to 'scene/main')
-rw-r--r--scene/main/viewport.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index c31155bd5c..b0898e2239 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -1061,10 +1061,10 @@ void Viewport::assign_next_enabled_camera_2d(const StringName &p_camera_group) {
get_tree()->get_nodes_in_group(p_camera_group, &camera_list);
Camera2D *new_camera = nullptr;
- for (const Node *E : camera_list) {
- const Camera2D *cam = Object::cast_to<Camera2D>(E);
+ for (Node *E : camera_list) {
+ Camera2D *cam = Object::cast_to<Camera2D>(E);
if (cam->is_enabled()) {
- new_camera = const_cast<Camera2D *>(cam);
+ new_camera = cam;
break;
}
}