Skip to content

Commit

Permalink
Check for empty properties
Browse files Browse the repository at this point in the history
Closes qzind#568
  • Loading branch information
tresf committed Feb 7, 2020
1 parent 1c5f9fb commit 44a4124
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions js/qz-tray.js
Original file line number Diff line number Diff line change
Expand Up @@ -666,14 +666,14 @@ var qz = (function() {
_qz.log.trace("Converting print data to v2.0 for " + _qz.websocket.connection.version);
for(var i = 0; i < printData.length; i++) {
if (printData[i].constructor === Object) {
if (printData[i].type.toUpperCase() === "RAW" && printData[i].format.toUpperCase() === "IMAGE") {
if (printData[i].flavor.toUpperCase() === "BASE64") {
if (printData[i].type && printData[i].type.toUpperCase() === "RAW" && printData[i].format && printData[i].format.toUpperCase() === "IMAGE") {
if (printData[i].flavor && printData[i].flavor.toUpperCase() === "BASE64") {
//special case for raw base64 images
printData[i].data = "data:image/compat;base64," + printData[i].data;
}
printData[i].flavor = "IMAGE"; //forces 'image' format when shifting for conversion
}
if (printData[i].type.toUpperCase() === "RAW" || printData[i].format.toUpperCase() === "COMMAND") {
if ((printData[i].type && printData[i].type.toUpperCase() === "RAW") || (printData[i].format && printData[i].format.toUpperCase() === "COMMAND")) {
printData[i].format = "RAW"; //forces 'raw' type when shifting for conversion
}

Expand Down
2 changes: 1 addition & 1 deletion sample.html
Original file line number Diff line number Diff line change
Expand Up @@ -1433,7 +1433,7 @@ <h4 class="panel-title">Options</h4>
case 'ESCP':
printData = [
//defaults to 'type: raw', 'format: command', and 'flavor: plain'
{ data: '\nPRINTED WITH QZ' + qzVersion + '.\n\n\n\n\n\n' }
{ data: '\nPRINTED WITH QZ ' + qzVersion + '.\n\n\n\n\n\n' }
];
break;
case 'EPCL':
Expand Down

0 comments on commit 44a4124

Please sign in to comment.