Skip to content

Commit

Permalink
StreamConfigurationMap.getHighResolutionOutputSizes() may returns nul…
Browse files Browse the repository at this point in the history
…l and cause NPE
  • Loading branch information
NashLegend committed Sep 19, 2016
1 parent 3e87fe3 commit 4b52bc8
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4b52bc8

Please sign in to comment.