add another check to ensure qr size consistency

This commit is contained in:
Bit Borealis 2023-08-19 08:22:19 +00:00
parent 0b80911a27
commit bd79ab671d

View file

@ -308,15 +308,16 @@ function sanitizeQrTxt(lines) {
if(lines[i].length !== 0) { if(lines[i].length !== 0) {
linesOut.push(lines[i]); linesOut.push(lines[i]);
} }
else { else if(i+1 !== lines.length) {
if(i+1 === lines.length) { throw "Unexpected empty line file."
return linesOut;
}
else {
throw "Unexpected empty line file."
}
} }
} }
for(let i=0;i<linesOut.length;i++) {
if(linesOut[i].length !== linesOut.length) {
throw `QR line: ${i} width:${linesOut[i].length} does not match QR size: ${linesOut.length}`
}
}
return linesOut;
} }
/*** /***