JsBarcode icon indicating copy to clipboard operation
JsBarcode copied to clipboard

Uncaught TypeError When Reading Undefined Text

Open aaronsheldon opened this issue 3 years ago • 1 comments

As of version 3.5.9, the following line generates an uncaught type error when attempting to read the undefined text: https://github.com/lindell/JsBarcode/blob/master/dist/JsBarcode.all.js#L190 The following minimal example from CodePen will work with 3.5.8 but not on or after 3.5.9:

const api = JsBarcode("#barcode");
api["CODE128"]("Hello");
api.blank(20);
api["CODE128"]("World");
api.render();

In contrast explicitly passing the text does render:

const api = JsBarcode("#barcode");
api["CODE128"]("Hello", { text: "Hello" });
api.blank(20);
api["CODE128"]("World", { text: "World" });
api.render();

aaronsheldon avatar Nov 12 '21 00:11 aaronsheldon

Thanks for an excellent bug report! I will take look at this as soon as I have the time.

lindell avatar Nov 16 '21 15:11 lindell