From b70e2151d15363836ee8d49633dfada683d54b5b Mon Sep 17 00:00:00 2001 From: Markus Ast Date: Wed, 27 Dec 2023 11:27:07 +0100 Subject: [PATCH] fix undefined variable for invalid font error fixes #316 --- CHANGELOG.md | 1 + lib/text.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 56af8c7..838f736 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed `Name must start with a leading slash` when adding an external document to a `pdfjs` document, and adding that result to another `pdfjs` document again (caused by a `null` object reference due to object streams). Also fixes duplicate objects when adding external documents with pages in object streams. - Fixed TypeScript type definition of `doc.asBuffer` and `doc.width`/`doc.height` +- Fixed referencing an undefined variable when throw an invalid font error ## [2.5.2] ### Fixed diff --git a/lib/text.js b/lib/text.js index fd32b77..3d4b48d 100644 --- a/lib/text.js +++ b/lib/text.js @@ -64,7 +64,7 @@ const Text = (module.exports = class Text extends Fragment { this._parts--; if (!Font.isFont(opts.font || this.defaultFont)) { - throw new TypeError("invalid font: " + font); + throw new TypeError("invalid font"); } const font = this._doc._fontInstance(opts.font || this.defaultFont);