From b686187af89fd259ce1230bccb0a52cc1567599b Mon Sep 17 00:00:00 2001 From: Samriddha Basu Date: Fri, 12 Aug 2016 01:58:18 +0530 Subject: [PATCH] Fix possible NullPointerException See issue #21 --- .../edwardvanraak/materialbarcodescanner/CameraSource.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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; + } } /**