Skip to content

Commit

Permalink
Fix assert in MicroQRCodeDetector
Browse files Browse the repository at this point in the history
Summary: Move asserts so they don't trigger unnecessarily.

Reviewed By: enpe

Differential Revision:
D64269660

Privacy Context Container: L1191897

fbshipit-source-id: 8e49c18ee669981fae46d6fa051b58a1aba057b2
  • Loading branch information
thorntondr authored and facebook-github-bot committed Oct 12, 2024
1 parent 8b777d5 commit c659f72
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions impl/ocean/cv/detector/qrcodes/MicroQRCodeDecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1342,7 +1342,7 @@ bool MicroQRCodeDecoder::decodeMicroQRCode(const std::vector<uint8_t>& modules,

std::vector<uint8_t> finalModules;

if (!decodeModules(modules, version, encodingMode, errorCorrectionCapacity, decodedData, finalModules))
if (!decodeModules(modules, version, encodingMode, errorCorrectionCapacity, decodedData, finalModules) || decodedData.empty())
{
return false;
}
Expand All @@ -1351,11 +1351,6 @@ bool MicroQRCodeDecoder::decodeMicroQRCode(const std::vector<uint8_t>& modules,
ocean_assert(errorCorrectionCapacity != MicroQRCode::ECC_INVALID);
ocean_assert(encodingMode != MicroQRCode::EM_INVALID_ENCODING_MODE);

if (decodedData.empty())
{
return false;
}

code = MicroQRCode(std::move(decodedData), encodingMode, errorCorrectionCapacity, std::move(finalModules), version);
ocean_assert(code.isValid());

Expand Down

0 comments on commit c659f72

Please sign in to comment.