mirror of
https://github.com/Merricx/qrazybox.git
synced 2025-04-20 01:59: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
11
js/main.js
11
js/main.js
|
@ -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) {
|
|
||||||
return linesOut;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw "Unexpected empty line file."
|
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