Merge pull request #1899 from benbro/master

Catch errors when parsing the localization header.
This commit is contained in:
Yury Delendik 2012-07-13 10:19:05 -07:00
commit 9c012f8a4d

View File

@ -399,9 +399,14 @@ var PDFDocument = (function PDFDocumentClosure() {
var length = this.stream.length;
var linearization = false;
if (length) {
linearization = new Linearization(this.stream);
if (linearization.length != length)
linearization = false;
try {
linearization = new Linearization(this.stream);
if (linearization.length != length)
linearization = false;
} catch (err) {
warn('The linearization data is not available ' +
'or unreadable pdf data is found');
}
}
// shadow the prototype getter with a data property
return shadow(this, 'linearization', linearization);