Skip to content

Commit

Permalink
Add null check
Browse files Browse the repository at this point in the history
  • Loading branch information
HashirRajah committed Sep 24, 2024
1 parent ab06815 commit 6b2eedf
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/android/Thumbnails.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ private static Bitmap thumbnailSmallImage(Options thumbnailOptions) throws Excep
options.inJustDecodeBounds = false;
Bitmap bitmap = BitmapFactory.decodeFile(thumbnailOptions.sourcePath, options);

if (bitmap == null) {
ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter();
String optionsJSON = ow.writeValueAsString(options);
throw new Exception("Could not decode file into bitmap object { sourcePath: " + thumbnailOptions.sourcePath + " options: " + optionsJSON + " }");
}

long begin = System.currentTimeMillis();
int oWidth = bitmap.getWidth();
int oHeight = bitmap.getHeight();
Expand Down

0 comments on commit 6b2eedf

Please sign in to comment.