Avoid exception in weird image situations

git-svn-id: https://zxing.googlecode.com/svn/trunk@1854 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen 2011-07-12 10:32:47 +00:00
parent 3b9dccf95f
commit 1c564fcf6a
2 changed files with 2 additions and 2 deletions

View file

@ -111,7 +111,7 @@ public final class DataMatrixReader implements Reader {
int matrixWidth = (right - left + 1) / moduleSize;
int matrixHeight = (bottom - top + 1) / moduleSize;
if (matrixWidth == 0 || matrixHeight == 0) {
if (matrixWidth <= 0 || matrixHeight <= 0) {
throw NotFoundException.getNotFoundInstance();
}

View file

@ -115,7 +115,7 @@ public class QRCodeReader implements Reader {
int matrixWidth = (right - left + 1) / moduleSize;
int matrixHeight = (bottom - top + 1) / moduleSize;
if (matrixWidth == 0 || matrixHeight == 0) {
if (matrixWidth <= 0 || matrixHeight <= 0) {
throw NotFoundException.getNotFoundInstance();
}
if (matrixHeight != matrixWidth) {