diff --git a/cpp/core/src/qrcode/decoder/Version.cpp b/cpp/core/src/qrcode/decoder/Version.cpp index 39bbf7cdb..15bf80ccc 100644 --- a/cpp/core/src/qrcode/decoder/Version.cpp +++ b/cpp/core/src/qrcode/decoder/Version.cpp @@ -118,6 +118,7 @@ namespace qrcode { FormatInformation::numBitsDiffering(versionBits, targetVersion); if (bitsDifference < bestDifference) { bestVersion = i + 7; + bestDifference = bitsDifference; } } // We can tolerate up to 3 bits of error since no two version info codewords will