diff --git a/android/src/com/google/zxing/client/android/YUVMonochromeBitmapSource.java b/android/src/com/google/zxing/client/android/YUVMonochromeBitmapSource.java index cda9929d1..a45fda66a 100755 --- a/android/src/com/google/zxing/client/android/YUVMonochromeBitmapSource.java +++ b/android/src/com/google/zxing/client/android/YUVMonochromeBitmapSource.java @@ -40,11 +40,12 @@ final class YUVMonochromeBitmapSource extends BaseMonochromeBitmapSource { * @param crop The rectangle within the yuvData to expose to MonochromeBitmapSource users */ YUVMonochromeBitmapSource(byte[] yuvData, int dataWidth, int dataHeight, Rect crop) { + if (crop.width() > dataWidth || crop.height() > dataHeight) { + throw new IllegalArgumentException(); + } mYUVData = yuvData; mDataWidth = dataWidth; mCrop = crop; - assert (crop.width() <= dataWidth); - assert (crop.height() <= dataHeight); } @Override diff --git a/androidtest/src/com/google/zxing/client/androidtest/BenchmarkItem.java b/androidtest/src/com/google/zxing/client/androidtest/BenchmarkItem.java index 4cb418c4c..e334ca0a4 100644 --- a/androidtest/src/com/google/zxing/client/androidtest/BenchmarkItem.java +++ b/androidtest/src/com/google/zxing/client/androidtest/BenchmarkItem.java @@ -27,8 +27,10 @@ public final class BenchmarkItem { private BarcodeFormat mFormat; public BenchmarkItem(String path, int runs) { + if (runs <= 0) { + throw new IllegalArgumentException(); + } mPath = path; - assert(runs > 0); mTimes = new int[runs]; mPosition = 0; mDecoded = false; diff --git a/androidtest/src/com/google/zxing/client/androidtest/SaveThread.java b/androidtest/src/com/google/zxing/client/androidtest/SaveThread.java index 16928589c..698d6eff5 100755 --- a/androidtest/src/com/google/zxing/client/androidtest/SaveThread.java +++ b/androidtest/src/com/google/zxing/client/androidtest/SaveThread.java @@ -67,8 +67,9 @@ final class SaveThread extends Thread { private void save(byte[] data, int width, int height) { int framingWidth = mFramingRect.width(); int framingHeight = mFramingRect.height(); - assert (framingWidth <= width); - assert (framingHeight <= height); + if (framingWidth > width || framingHeight > height) { + throw new IllegalArgumentException(); + } int leftOffset = mFramingRect.left; int topOffset = mFramingRect.top;