mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-27 10:17:18 +00:00
Prevent NPE
This commit is contained in:
parent
915e9fc36f
commit
d7a7afca24
1 changed files with 11 additions and 9 deletions
|
@ -224,6 +224,7 @@ public class AdapterMedia extends RecyclerView.Adapter<AdapterMedia.ViewHolder>
|
||||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||||
try (InputStream is = new FileInputStream(file)) {
|
try (InputStream is = new FileInputStream(file)) {
|
||||||
Bitmap bitmap = ImageHelper.getScaledBitmap(is, file.getAbsolutePath(), type, max);
|
Bitmap bitmap = ImageHelper.getScaledBitmap(is, file.getAbsolutePath(), type, max);
|
||||||
|
if (bitmap != null) {
|
||||||
int width = bitmap.getWidth(), height = bitmap.getHeight();
|
int width = bitmap.getWidth(), height = bitmap.getHeight();
|
||||||
int[] pixels = new int[width * height];
|
int[] pixels = new int[width * height];
|
||||||
bitmap.getPixels(pixels, 0, width, 0, 0, width, height);
|
bitmap.getPixels(pixels, 0, width, 0, 0, width, height);
|
||||||
|
@ -234,6 +235,7 @@ public class AdapterMedia extends RecyclerView.Adapter<AdapterMedia.ViewHolder>
|
||||||
Result result = reader.decode(bBitmap);
|
Result result = reader.decode(bBitmap);
|
||||||
args.putString("barcode_text", Helper.getPrintableString(result.getText(), false));
|
args.putString("barcode_text", Helper.getPrintableString(result.getText(), false));
|
||||||
args.putString("barcode_format", result.getBarcodeFormat().name());
|
args.putString("barcode_format", result.getBarcodeFormat().name());
|
||||||
|
}
|
||||||
} catch (NotFoundException ex) {
|
} catch (NotFoundException ex) {
|
||||||
Log.i(ex);
|
Log.i(ex);
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
|
|
Loading…
Reference in a new issue