This commit is contained in:
Sean Owen 2023-08-17 15:28:32 -05:00
parent fc2f1c9b0f
commit aa58f2ec30

View file

@ -249,6 +249,9 @@ public final class Code128Writer extends OneDimensionalCodeWriter {
static boolean[] produceResult(Collection<int[]> patterns, int checkSum) {
// Compute and append checksum
checkSum %= 103;
if (checkSum < 0) {
throw new IllegalArgumentException("Unable to compute a valid input checksum");
}
patterns.add(Code128Reader.CODE_PATTERNS[checkSum]);
// Append stop code