rkusa / pdfjs

A Portable Document Format (PDF) generation library targeting both the server- and client-side.
MIT License
774 stars 142 forks source link

Invalid throw code in text._render #316

Closed vjau closed 9 months ago

vjau commented 12 months ago

This code in Text._render function

if (!Font.isFont(opts.font || this.defaultFont)) {
      throw new TypeError("invalid font: " + font);
    }

const font = this._doc._fontInstance(opts.font || this.defaultFont);

has a bug. The throw use font which is defined on the next line

rkusa commented 9 months ago

Should be fixed, thanks for the report