Dont act on Camera if it is in the middle of a stop

pull/50/head
Mattia Iavarone 8 years ago
parent f8d38e3c8c
commit 8e5831d498
  1. 6
      cameraview/src/main/java/com/otaliastudios/cameraview/Camera1.java

@ -192,7 +192,7 @@ class Camera1 extends CameraController {
Exception error = null;
LOG.i("onStop:", "About to clean up.");
mHandler.get().removeCallbacks(mPostFocusResetRunnable);
if (isCameraAvailable()) {
if (mCamera != null) {
LOG.i("onStop:", "Clean up.", "Ending video?", mIsCapturingVideo);
if (mIsCapturingVideo) endVideo();
@ -511,7 +511,9 @@ class Camera1 extends CameraController {
}
private boolean isCameraAvailable() {
return mCamera != null;
// Don't do if state is stopping. The camera instance might have been released,
// even if onStop did not return yet.
return mCamera != null && mState > STATE_STOPPING;
}

Loading…
Cancel
Save