Skip to content

Commit

Permalink
Added try/catch block to control barcode substring reading error.
Browse files Browse the repository at this point in the history
  • Loading branch information
telco2011 committed Nov 17, 2017
1 parent 10ec187 commit 053a20f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,12 @@ function PDFDicer() {
if (this.range[memBarcodeID] == null) {
this.range[memBarcodeID] = new Object();
this.range[memBarcodeID].barcode = new Object();
this.range[memBarcodeID].barcode.id = page.barcode.substring(page.barcode.lastIndexOf("/") + 1, page.barcode.length);
try {
this.range[memBarcodeID].barcode.id = page.barcode.substring(page.barcode.lastIndexOf("/") + 1, page.barcode.length);
} catch (error) {
// The barcode scanner is not able to find the barcode information.
this.range[memBarcodeID].barcode.id = page.barcode;
}
this.range[memBarcodeID].barcode.start = page.barcode;
this.range[memBarcodeID].pages = 1;
this.range[memBarcodeID].from = index + 1;
Expand Down

0 comments on commit 053a20f

Please sign in to comment.