Showing
1 changed file
with
7 additions
and
0 deletions
| @@ -185,6 +185,13 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler, | @@ -185,6 +185,13 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler, | ||
| 185 | device = AVCaptureDevice.devices(for: .video).filter({$0.position == position}).first | 185 | device = AVCaptureDevice.devices(for: .video).filter({$0.position == position}).first |
| 186 | } | 186 | } |
| 187 | 187 | ||
| 188 | + if (device == nil) { | ||
| 189 | + result(FlutterError(code: "MobileScanner", | ||
| 190 | + message: "No camera found!", | ||
| 191 | + details: nil)) | ||
| 192 | + return | ||
| 193 | + } | ||
| 194 | + | ||
| 188 | // Enable the torch if parameter is set and torch is available | 195 | // Enable the torch if parameter is set and torch is available |
| 189 | if (device.hasTorch) { | 196 | if (device.hasTorch) { |
| 190 | do { | 197 | do { |
-
Please register or login to post a comment