Skip to content

Commit

Permalink
+ add exception when file is not a picture (as example - video file)
Browse files Browse the repository at this point in the history
  • Loading branch information
Andriy Shevchuk committed Jun 1, 2018
1 parent 1bf68d4 commit cba310c
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ static BitmapSampled decodeSampledBitmap(Context context, Uri uri, int reqWidth,
// First decode with inJustDecodeBounds=true to check dimensions
BitmapFactory.Options options = decodeImageForOption(resolver, uri);

if(options.outWidth == -1 && options.outHeight == -1)
throw new RuntimeException("File is not a picture");

// Calculate inSampleSize
options.inSampleSize =
Math.max(
Expand Down

0 comments on commit cba310c

Please sign in to comment.