Skip to content

Commit

Permalink
Fixes crash after accepting permission dialog (google#23)
Browse files Browse the repository at this point in the history
* Fixes google#1 - Camera crashes after accepting permission dialog

* Update try catch style
  • Loading branch information
ivacf authored and yaraki committed Oct 4, 2016
1 parent c4af56f commit ebc1772
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ public void onConfigured(@NonNull CameraCaptureSession session) {
mCaptureSession.setRepeatingRequest(mPreviewRequestBuilder.build(),
mCaptureCallback, null);
} catch (CameraAccessException e) {
Log.e(TAG, "Failed to start camera preview because it couldn't access camera", e);
} catch (IllegalStateException e) {
Log.e(TAG, "Failed to start camera preview.", e);
}
}
Expand All @@ -109,7 +111,9 @@ public void onConfigureFailed(@NonNull CameraCaptureSession session) {

@Override
public void onClosed(@NonNull CameraCaptureSession session) {
mCaptureSession = null;
if (mCaptureSession != null && mCaptureSession.equals(session)) {
mCaptureSession = null;
}
}

};
Expand Down

0 comments on commit ebc1772

Please sign in to comment.