Skip to content

Commit

Permalink
Added safety check to prevent app crash.
Browse files Browse the repository at this point in the history
Closes #238
  • Loading branch information
gdombiak committed Jan 8, 2020
1 parent 88b1ba9 commit 8fce0a0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions OctoPod/Panel UI/PanelViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,10 @@ class PanelViewController: UIViewController, UIPopoverPresentationControllerDele
}

fileprivate func updateForCameraOrientation(orientation: UIImage.Orientation, devicePortrait: Bool = UIApplication.shared.statusBarOrientation.isPortrait) {
if cameraHeightConstraint == nil {
// Do nothing if for some reason the weak var cameraHeightConstraint is no longer there. Will fix a reported crash but not sure if it will crash later
return
}
if orientation == UIImage.Orientation.left || orientation == UIImage.Orientation.leftMirrored || orientation == UIImage.Orientation.rightMirrored || orientation == UIImage.Orientation.right {
cameraHeightConstraint.constant = 281 + 50
} else {
Expand Down

0 comments on commit 8fce0a0

Please sign in to comment.