Skip to content

Commit

Permalink
修复一些问题
Browse files Browse the repository at this point in the history
  • Loading branch information
ailiwean committed Jan 15, 2021
1 parent 7fc7122 commit 90af191
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,18 +154,22 @@ public void reset() {
}

private Result decodeInternal(BinaryBitmap image) {
Result resultFinal = null;
if (readers != null) {
for (Reader reader : readers) {
try {
return reader.decode(image, hints);
Result result = reader.decode(image, hints);
if (result != null)
resultFinal = result;
if (result != null && result.getText() != null)
return resultFinal;
} catch (ReaderException re) {
// continue
} catch (Exception ignored) {

}
}
}
return null;
return resultFinal;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.ailiwean.core.zxing.core;

import android.text.TextUtils;
import android.util.Log;

import com.ailiwean.core.zxing.core.common.HybridBinarizer;
import com.ailiwean.core.zxing.core.common.HybridBinarizerCrude;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public Result decode(BinaryBitmap image) throws NotFoundException, ChecksumExcep

@Override
public final Result decode(BinaryBitmap image, Map<DecodeHintType, ?> hints)
throws ChecksumException, FormatException {
throws ChecksumException, FormatException, NotFoundException {
DecoderResult decoderResult;
ResultPoint[] points;
if (hints != null && hints.containsKey(DecodeHintType.PURE_BARCODE)) {
Expand All @@ -89,10 +89,10 @@ public final Result decode(BinaryBitmap image, Map<DecodeHintType, ?> hints)
try {
detectorResult = new Detector2(image.getBlackMatrix()).detect(hints);
} catch (NotFoundException notFoundException) {
return null;
throw NotFoundException.getNotFoundInstance();
}
} else
return null;
throw NotFoundException.getNotFoundInstance();
}
points = detectorResult.getPoints();
try {
Expand Down

0 comments on commit 90af191

Please sign in to comment.