mirror of
https://github.com/Merricx/qrazybox.git
synced 2025-04-19 17:49:04 +02:00
add another check to ensure qr size consistency
This commit is contained in:
parent
0b80911a27
commit
bd79ab671d
1 changed files with 8 additions and 7 deletions
15
js/main.js
15
js/main.js
|
@ -308,15 +308,16 @@ function sanitizeQrTxt(lines) {
|
|||
if(lines[i].length !== 0) {
|
||||
linesOut.push(lines[i]);
|
||||
}
|
||||
else {
|
||||
if(i+1 === lines.length) {
|
||||
return linesOut;
|
||||
}
|
||||
else {
|
||||
throw "Unexpected empty line file."
|
||||
}
|
||||
else if(i+1 !== lines.length) {
|
||||
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;
|
||||
}
|
||||
|
||||
/***
|
||||
|
|
Loading…
Add table
Reference in a new issue