summaryrefslogtreecommitdiff
path: root/scene/2d
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-06-12 12:49:21 +0200
committerGitHub <noreply@github.com>2019-06-12 12:49:21 +0200
commit971b5160c61ccb7a009966d17d339997ea343da3 (patch)
treeff0d038213821bbf258f9fa9fd36288a7c7d9bbc /scene/2d
parentf160c81f683d8a523f23d3c4f7a76151a75fe875 (diff)
parent8245db869f05a86e88338236d22765b87cc71db8 (diff)
Merge pull request #29306 from qarmin/small_code_fixes
Small fixes to unrechable code, possibly overflows, using NULL pointers
Diffstat (limited to 'scene/2d')
-rw-r--r--scene/2d/camera_2d.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp
index 11846654c5..aa14491577 100644
--- a/scene/2d/camera_2d.cpp
+++ b/scene/2d/camera_2d.cpp
@@ -44,15 +44,16 @@ void Camera2D::_update_scroll() {
return;
}
+ if (!viewport)
+ return;
+
if (current) {
ERR_FAIL_COND(custom_viewport && !ObjectDB::get_instance(custom_viewport_id));
Transform2D xform = get_camera_transform();
- if (viewport) {
- viewport->set_canvas_transform(xform);
- }
+ viewport->set_canvas_transform(xform);
Size2 screen_size = viewport->get_visible_rect().size;
Point2 screen_offset = (anchor_mode == ANCHOR_MODE_DRAG_CENTER ? (screen_size * 0.5) : Point2());