Skip to content

Commit 9c012f8

Browse files
committed
Merge pull request mozilla#1899 from benbro/master
Catch errors when parsing the localization header.
2 parents c757eed + a63814e commit 9c012f8

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/core.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -399,9 +399,14 @@ var PDFDocument = (function PDFDocumentClosure() {
399399
var length = this.stream.length;
400400
var linearization = false;
401401
if (length) {
402-
linearization = new Linearization(this.stream);
403-
if (linearization.length != length)
404-
linearization = false;
402+
try {
403+
linearization = new Linearization(this.stream);
404+
if (linearization.length != length)
405+
linearization = false;
406+
} catch (err) {
407+
warn('The linearization data is not available ' +
408+
'or unreadable pdf data is found');
409+
}
405410
}
406411
// shadow the prototype getter with a data property
407412
return shadow(this, 'linearization', linearization);

0 commit comments

Comments
 (0)