Skip to content
This repository has been archived by the owner on Mar 17, 2022. It is now read-only.

Commit

Permalink
Fix null check
Browse files Browse the repository at this point in the history
  • Loading branch information
rmtheis committed Apr 20, 2018
1 parent 6509ff4 commit 229906e
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions tess-two/src/com/googlecode/leptonica/android/WriteFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,18 +112,19 @@ public static Bitmap writeBitmap(Pix pixs) {
throw new IllegalArgumentException("Source pix must be non-null");

final int[] dimensions = pixs.getDimensions();
final int width = dimensions[Pix.INDEX_W];
final int height = dimensions[Pix.INDEX_H];
if (dimensions != null) {
final int width = dimensions[Pix.INDEX_W];
final int height = dimensions[Pix.INDEX_H];

final Bitmap.Config config = Bitmap.Config.ARGB_8888;
final Bitmap bitmap = Bitmap.createBitmap(width, height, config);
final Bitmap.Config config = Bitmap.Config.ARGB_8888;
final Bitmap bitmap = Bitmap.createBitmap(width, height, config);

if (nativeWriteBitmap(pixs.getNativePix(), bitmap)) {
return bitmap;
}

bitmap.recycle();
if (nativeWriteBitmap(pixs.getNativePix(), bitmap)) {
return bitmap;
}

bitmap.recycle();
}
return null;
}

Expand Down

0 comments on commit 229906e

Please sign in to comment.