mirror of
https://github.com/zxing/zxing.git
synced 2024-11-09 20:44:03 -08:00
Prevent --raw CLR option from failing if result.getRawBytes() is null (#1683)
Fixes https://github.com/zxing/zxing/issues/1682
This commit is contained in:
parent
557b5fcf0e
commit
672bd40958
|
@ -168,14 +168,17 @@ final class DecodeWorker implements Callable<Integer> {
|
|||
|
||||
if (config.outputRaw) {
|
||||
StringBuilder rawData = new StringBuilder();
|
||||
byte[] rawBytes = result.getRawBytes();
|
||||
|
||||
for (byte b : result.getRawBytes()) {
|
||||
rawData.append(String.format("%02X", b & 0xff));
|
||||
rawData.append(" ");
|
||||
if (rawBytes != null) {
|
||||
for (byte b : rawBytes) {
|
||||
rawData.append(String.format("%02X", b & 0xff));
|
||||
rawData.append(" ");
|
||||
}
|
||||
rawData.setLength(rawData.length() - 1); // chop off final space
|
||||
|
||||
output.write("Raw bits:\n" + rawData + "\n");
|
||||
}
|
||||
rawData.setLength(rawData.length() - 1); // chop off final space
|
||||
|
||||
output.write("Raw bits:\n" + rawData + "\n");
|
||||
}
|
||||
|
||||
ResultPoint[] resultPoints = result.getResultPoints();
|
||||
|
|
Loading…
Reference in a new issue