Fix crash when tapping unloaded image attachment

This commit is contained in:
Shadowfacts 2020-01-25 22:03:21 -05:00
parent 26c99a1a35
commit f9a62ec3f3
Signed by untrusted user: shadowfacts
GPG Key ID: 94A5AB95422746E5
1 changed files with 2 additions and 2 deletions

View File

@ -148,7 +148,7 @@ extension TuskerNavigationDelegate where Self: UIViewController {
}
private func sourceViewInfo(_ sourceView: UIImageView?) -> LargeImageViewController.SourceInfo? {
guard let sourceView = sourceView else { return nil }
guard let sourceView = sourceView, let image = sourceView.image else { return nil }
var sourceFrame = sourceView.convert(sourceView.bounds, to: view)
if let scrollView = view as? UIScrollView {
@ -159,7 +159,7 @@ extension TuskerNavigationDelegate where Self: UIViewController {
let y = sourceFrame.minY * scale - scrollView.contentOffset.y + scrollView.frame.minY
sourceFrame = CGRect(x: x, y: y, width: width, height: height)
}
return (image: sourceView.image!, frame: sourceFrame, cornerRadius: sourceView.layer.cornerRadius)
return (image: image, frame: sourceFrame, cornerRadius: sourceView.layer.cornerRadius)
}
func largeImage(_ image: UIImage, description: String?, sourceView: UIImageView) -> LargeImageViewController {