Fix issue 189. Need to guard against 'false positive' success in reading version info.

git-svn-id: https://zxing.googlecode.com/svn/trunk@934 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen 2009-05-06 21:50:13 +00:00
parent b2bd63a228
commit 0c07f139b5

View file

@ -120,7 +120,7 @@ final class BitMatrixParser {
} }
parsedVersion = Version.decodeVersionInformation(versionBits); parsedVersion = Version.decodeVersionInformation(versionBits);
if (parsedVersion != null) { if (parsedVersion != null && parsedVersion.getDimensionForVersion() == dimension) {
return parsedVersion; return parsedVersion;
} }
@ -134,7 +134,7 @@ final class BitMatrixParser {
} }
parsedVersion = Version.decodeVersionInformation(versionBits); parsedVersion = Version.decodeVersionInformation(versionBits);
if (parsedVersion != null) { if (parsedVersion != null && parsedVersion.getDimensionForVersion() == dimension) {
return parsedVersion; return parsedVersion;
} }
throw ReaderException.getInstance(); throw ReaderException.getInstance();