Skip to content
This repository has been archived by the owner on Sep 15, 2023. It is now read-only.

Commit

Permalink
Check if fragment and view are attached before accessing the view dis…
Browse files Browse the repository at this point in the history
…play
  • Loading branch information
M-Wong committed Oct 13, 2021
1 parent 65426ff commit d7877cd
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ abstract class QrScanFragment : Fragment() {

@SuppressLint("ClickableViewAccessibility")
private fun initializeCamera() {
if (!isAdded || !qrCodeScanner.isAttachedToWindow) return

val rotation = qrCodeScanner.display.rotation
preview = Preview.Builder()
.setTargetResolution(Size(720, 1280))
Expand Down

0 comments on commit d7877cd

Please sign in to comment.