EddieLa / JOB

A Barcode scanner capapable of reading Code128, Code93, Code39, Standard/Industrial 2 of 5, Interleaved 2 of 5, Codabar and EAN-13 barcodes in javascript.
http://eddiela.github.io/JOB
600 stars 204 forks source link

NullPointerExeption #22

Closed BobbyJay closed 9 years ago

BobbyJay commented 9 years ago

JOB/src/DecoderWorker.js on Line 453: newTable[0].length throws an error, when newTable is an empty array, therefore no newTable[0] exists. Fixed this with a simple condition:

if (newTable.length > 0) { Image.table = newTable; Image.width = newTable.length; Image.height = newTable[0].length; CreateImageData(); allTables.push({ table: newTable, data: new Uint8ClampedArray(Image.data), width: Image.width, height: Image.height }); }

This happened with image #102 of Muenster BarcodeDB (EAN: 4-000417-106001, Image: 4000417106001-01_N95-2592x1944_scaledTo800x600bilinear.jpg)

EddieLa commented 9 years ago

Yeah, I hadn't uploaded that fix yet but was aware of it. Thanks for the heads up anyway.