Skip to content

Commit

Permalink
Fixed crash when tapping flash button with front camera.
Browse files Browse the repository at this point in the history
  • Loading branch information
NikKovIos committed Jan 6, 2022
1 parent 4ab09a1 commit dd2fa33
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Source/Pages/Photo/YPPhotoCaptureHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ internal final class YPPhotoCaptureHelper: NSObject {
return deviceInput?.device
}
var hasFlash: Bool {
return device?.hasFlash ?? false
let isFrontCamera = device?.position == .front
let deviceHasFlash = device?.hasFlash ?? false
return !isFrontCamera && deviceHasFlash
}

private let sessionQueue = DispatchQueue(label: "YPPhotoCaptureHelperQueue", qos: .background)
Expand Down

0 comments on commit dd2fa33

Please sign in to comment.