diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-06-12 12:49:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-12 12:49:21 +0200 |
commit | 971b5160c61ccb7a009966d17d339997ea343da3 (patch) | |
tree | ff0d038213821bbf258f9fa9fd36288a7c7d9bbc /scene/2d | |
parent | f160c81f683d8a523f23d3c4f7a76151a75fe875 (diff) | |
parent | 8245db869f05a86e88338236d22765b87cc71db8 (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.cpp | 7 |
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()); |