diff --git a/core/src/zxing/oned/UPCAReader.cpp b/core/src/zxing/oned/UPCAReader.cpp index 38ca507..47efb0f 100644 --- a/core/src/zxing/oned/UPCAReader.cpp +++ b/core/src/zxing/oned/UPCAReader.cpp @@ -19,7 +19,7 @@ */ #include "UPCAReader.h" -#include +#include using zxing::oned::UPCAReader; using zxing::Ref; @@ -29,6 +29,7 @@ using zxing::Result; using zxing::BitArray; using zxing::BinaryBitmap; using zxing::DecodeHints; +using zxing::FormatException; UPCAReader::UPCAReader() : ean13Reader() {} @@ -53,17 +54,15 @@ int UPCAReader::decodeMiddle(Ref row, } Ref UPCAReader::maybeReturnResult(Ref result) { - if (result.empty()) { - return result; - } const std::string& text = (result->getText())->getText(); if (text[0] == '0') { Ref resultString(new String(text.substr(1))); Ref res(new Result(resultString, result->getRawBytes(), result->getResultPoints(), BarcodeFormat::UPC_A)); return res; + } else { + throw FormatException(); } - return Ref(); } zxing::BarcodeFormat UPCAReader::getBarcodeFormat(){