Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

Commit 0231255

Browse files
committed
Fix Exception for calling stop in onPictureTaken Callback
Fixes bug #67
1 parent 3eaeac0 commit 0231255

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

library/src/main/api14/com/google/android/cameraview/Camera1.java

+1
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ void takePictureInternal() {
243243
public void onPictureTaken(byte[] data, Camera camera) {
244244
isPictureCaptureInProgress.set(false);
245245
mCallback.onPictureTaken(data);
246+
if (!isCameraOpened()) return;
246247
camera.cancelAutoFocus();
247248
camera.startPreview();
248249
}

library/src/main/api21/com/google/android/cameraview/Camera2.java

+1
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,7 @@ public void onCaptureCompleted(@NonNull CameraCaptureSession session,
655655
* capturing a still picture.
656656
*/
657657
void unlockFocus() {
658+
if (!isCameraOpened()) return;
658659
mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AF_TRIGGER,
659660
CaptureRequest.CONTROL_AF_TRIGGER_CANCEL);
660661
try {

0 commit comments

Comments
 (0)