Skip to content

Commit

Permalink
fix(ios): prevents iOS plugin from crashing when destroy is called wi…
Browse files Browse the repository at this point in the history
…thout a callback

Closes #142
  • Loading branch information
authored and bitjson committed May 17, 2018
1 parent c9531b8 commit 610a004
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/ios/QRScanner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ class QRScanner : CDVPlugin, AVCaptureMetadataOutputObjectsDelegate {
}

func removePreviewLayer() {
self.videoPreviewLayer!.removeFromSuperlayer()
self.videoPreviewLayer = nil
if self.videoPreviewLayer != nil {
self.videoPreviewLayer!.removeFromSuperlayer()
self.videoPreviewLayer = nil
}
}
}

Expand Down

0 comments on commit 610a004

Please sign in to comment.