From cb49651d7325b3debf610ddadcdb4db0fac8c3df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Powa=C5=82owski?= Date: Sun, 26 Jan 2020 15:21:27 +0100 Subject: [PATCH] Fixed iOS crash due to force unwrap of nil --- ios/Classes/QRView.swift | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ios/Classes/QRView.swift b/ios/Classes/QRView.swift index d1cc010..68f7381 100644 --- a/ios/Classes/QRView.swift +++ b/ios/Classes/QRView.swift @@ -26,10 +26,8 @@ public class QRView:NSObject,FlutterPlatformView { try scanner?.startScanning(resultBlock: { codes in if let codes = codes { for code in codes { - if (code != nil && code.stringValue != nil) { - let stringValue = code.stringValue! - self.channel.invokeMethod("onRecognizeQR", arguments: stringValue) - } + guard let stringValue = code.stringValue else { continue } + self.channel.invokeMethod("onRecognizeQR", arguments: stringValue) } } })