diff --git a/library/src/main/camera2/com/google/android/cameraview/Camera2.java b/library/src/main/camera2/com/google/android/cameraview/Camera2.java index dc220162..f9ee33ba 100644 --- a/library/src/main/camera2/com/google/android/cameraview/Camera2.java +++ b/library/src/main/camera2/com/google/android/cameraview/Camera2.java @@ -424,8 +424,11 @@ private void collectCameraInfo() { mPictureSizes.clear(); // try to get hi-res output sizes for Marshmellow and higher if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - for (android.util.Size size : map.getHighResolutionOutputSizes(ImageFormat.JPEG)) { - mPictureSizes.add(new Size(size.getWidth(), size.getHeight())); + android.util.Size[] outputSizes = map.getHighResolutionOutputSizes(ImageFormat.JPEG); + if (outputSizes != null) { + for (android.util.Size size : map.getHighResolutionOutputSizes(ImageFormat.JPEG)) { + mPictureSizes.add(new Size(size.getWidth(), size.getHeight())); + } } } // fallback camera sizes and lower than Marshmellow