cameraview icon indicating copy to clipboard operation
cameraview copied to clipboard

Nullpointer when setting picture size parameter in Camera1

Open jamesbluecrow opened this issue 8 years ago • 0 comments

The camera crashes in some devices running Android 5.1. This is the issue to track it: https://github.com/google/cameraview/issues/72

Caused by java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.Object java.util.SortedSet.last()' on a null object reference
       at com.google.android.cameraview.Camera1.adjustCameraParameters(Camera1.java:349)
       at com.google.android.cameraview.Camera1.setAspectRatio(Camera1.java:168)
       at com.google.android.cameraview.CameraView.setAspectRatio(CameraView.java:335)

The reason is that we try to access the last PictureSizes item for an AspectRatio and there is no such size for that aspect ratio.

In those case we should be defaulting to the PreviewSizes

jamesbluecrow avatar Oct 03 '17 14:10 jamesbluecrow