diff --git a/.changeset/slow-snakes-relate.md b/.changeset/slow-snakes-relate.md new file mode 100644 index 0000000..691283f --- /dev/null +++ b/.changeset/slow-snakes-relate.md @@ -0,0 +1,5 @@ +--- +'@capacitor-mlkit/barcode-scanning': patch +--- + +fix(android): `readBarcodesFromImage(...)` throws a null exception diff --git a/packages/barcode-scanning/android/src/main/java/io/capawesome/capacitorjs/plugins/mlkit/barcodescanning/BarcodeScannerHelper.java b/packages/barcode-scanning/android/src/main/java/io/capawesome/capacitorjs/plugins/mlkit/barcodescanning/BarcodeScannerHelper.java index 8da0148..413aa7c 100644 --- a/packages/barcode-scanning/android/src/main/java/io/capawesome/capacitorjs/plugins/mlkit/barcodescanning/BarcodeScannerHelper.java +++ b/packages/barcode-scanning/android/src/main/java/io/capawesome/capacitorjs/plugins/mlkit/barcodescanning/BarcodeScannerHelper.java @@ -21,7 +21,7 @@ public class BarcodeScannerHelper { public static JSObject createBarcodeResultForBarcode(@NonNull Barcode barcode, @Nullable Point imageSize, @Nullable Point screenSize) { Point[] cornerPoints = barcode.getCornerPoints(); JSArray cornerPointsResult = new JSArray(); - if (cornerPoints != null || imageSize != null || screenSize != null) { + if (cornerPoints != null && imageSize != null && screenSize != null) { Point[] normalizedCornerPoints = normalizeCornerPoints(cornerPoints, imageSize, screenSize); for (int i = 0; i < normalizedCornerPoints.length; i++) { JSArray cornerPointResult = new JSArray();