mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Handle errors in the "Loading by ref" code-path in PartialEvaluator.loadFont
Note how we currently throw a "raw" Error, which is problematical since all of the `PartialEvaluator.loadFont` call-sites expect a Promise to be returned. Furthermore, this also means that we don't benefit from the fallback code-path that now exists below. *Please note:* Unfortunately I don't have a test-case that fails without this patch, since it's something I happened to notice when reading the code while working on another patch.
This commit is contained in:
parent
3256761ead
commit
acd61a138e
1 changed files with 2 additions and 3 deletions
|
@ -1176,10 +1176,9 @@ class PartialEvaluator {
|
|||
let fontRef;
|
||||
if (font) {
|
||||
// Loading by ref.
|
||||
if (!(font instanceof Ref)) {
|
||||
throw new FormatError('The "font" object should be a reference.');
|
||||
if (font instanceof Ref) {
|
||||
fontRef = font;
|
||||
}
|
||||
fontRef = font;
|
||||
} else {
|
||||
// Loading by name.
|
||||
const fontRes = resources.get("Font");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue