Rethrow MissingDataException when needed
In core/document.js: `PDFDocument.prototype.parse` accesses a dictionary property, which could throw if the underlying data is not yet available. In core/obj.js: `get Catalog.prototype.metadata` calls `stream.getBytes`, which can throw MissingDataException too when the stream is a ChunkedStream.
This commit is contained in:
parent
086021b21e
commit
49af56f730
@ -467,6 +467,9 @@ var PDFDocument = (function PDFDocumentClosure() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
|
if (ex instanceof MissingDataException) {
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
info('Something wrong with AcroForm entry');
|
info('Something wrong with AcroForm entry');
|
||||||
this.acroForm = null;
|
this.acroForm = null;
|
||||||
}
|
}
|
||||||
|
@ -104,6 +104,9 @@ var Catalog = (function CatalogClosure() {
|
|||||||
try {
|
try {
|
||||||
metadata = stringToUTF8String(bytesToString(stream.getBytes()));
|
metadata = stringToUTF8String(bytesToString(stream.getBytes()));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
if (e instanceof MissingDataException) {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
info('Skipping invalid metadata.');
|
info('Skipping invalid metadata.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user