diff --git a/materialbarcodescanner/src/main/java/com/edwardvanraak/materialbarcodescanner/CameraSource.java b/materialbarcodescanner/src/main/java/com/edwardvanraak/materialbarcodescanner/CameraSource.java index b2160d9..2a89626 100644 --- a/materialbarcodescanner/src/main/java/com/edwardvanraak/materialbarcodescanner/CameraSource.java +++ b/materialbarcodescanner/src/main/java/com/edwardvanraak/materialbarcodescanner/CameraSource.java @@ -1071,8 +1071,10 @@ private class FrameProcessingRunnable implements Runnable { @SuppressLint("Assert") void release() { assert (mProcessingThread.getState() == State.TERMINATED); - mDetector.release(); - mDetector = null; + if (mDetector != null) { + mDetector.release(); + mDetector = null; + } } /**