Skip to content

Commit cba310c

Browse files
author
Andriy Shevchuk
committed
+ add exception when file is not a picture (as example - video file)
1 parent 1bf68d4 commit cba310c

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

cropper/src/main/java/com/theartofdev/edmodo/cropper/BitmapUtils.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ static BitmapSampled decodeSampledBitmap(Context context, Uri uri, int reqWidth,
113113
// First decode with inJustDecodeBounds=true to check dimensions
114114
BitmapFactory.Options options = decodeImageForOption(resolver, uri);
115115

116+
if(options.outWidth == -1 && options.outHeight == -1)
117+
throw new RuntimeException("File is not a picture");
118+
116119
// Calculate inSampleSize
117120
options.inSampleSize =
118121
Math.max(

0 commit comments

Comments
 (0)