Merge pull request #46008 from akien-mga/3.2-fix-camera-align-crash-45976
Camera2D: Fix crash calling align when not in tree
This commit is contained in:
commit
1611d3dc17
1 changed files with 2 additions and 1 deletions
|
@ -94,7 +94,7 @@ Vector2 Camera2D::get_zoom() const {
|
|||
|
||||
Transform2D Camera2D::get_camera_transform() {
|
||||
|
||||
if (!get_tree())
|
||||
if (!get_tree() || !viewport)
|
||||
return Transform2D();
|
||||
|
||||
ERR_FAIL_COND_V(custom_viewport && !ObjectDB::get_instance(custom_viewport_id), Transform2D());
|
||||
|
@ -498,6 +498,7 @@ void Camera2D::reset_smoothing() {
|
|||
|
||||
void Camera2D::align() {
|
||||
|
||||
ERR_FAIL_COND(!is_inside_tree() || !viewport);
|
||||
ERR_FAIL_COND(custom_viewport && !ObjectDB::get_instance(custom_viewport_id));
|
||||
|
||||
Size2 screen_size = viewport->get_visible_rect().size;
|
||||
|
|
Loading…
Reference in a new issue