Skip to content

Commit

Permalink
images: add guard statements
Browse files Browse the repository at this point in the history
  • Loading branch information
ericholguin committed Oct 3, 2023
1 parent badd168 commit 4677d66
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions damus/Views/Images/ImageContextMenuModifier.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,12 @@ struct ImageContextMenuModifier: ViewModifier {
}
Button {
qrCodeLink = ""
let detector:CIDetector = CIDetector(ofType: CIDetectorTypeQRCode, context: nil, options: [CIDetectorAccuracy:CIDetectorAccuracyHigh])!
let ciImage: CIImage = CIImage(image:someImage)!
guard let detector:CIDetector = CIDetector(ofType: CIDetectorTypeQRCode, context: nil, options: [CIDetectorAccuracy:CIDetectorAccuracyHigh]) else {
return
}
guard let ciImage = CIImage(image:someImage) else {
return
}
let features = detector.features(in: ciImage)
if let qrfeatures = features as? [CIQRCodeFeature] {
for feature in qrfeatures {
Expand Down

0 comments on commit 4677d66

Please sign in to comment.