Prevent hard errors if fetching the Encrypt dictionary fails in XRef.parse

This commit is contained in:
Jonas Jenwald 2018-06-19 10:16:23 +02:00
parent 30ad62a86a
commit e84813e7cc

View File

@ -855,7 +855,16 @@ var XRef = (function XRefClosure() {
} }
trailerDict.assignXref(this); trailerDict.assignXref(this);
this.trailer = trailerDict; this.trailer = trailerDict;
var encrypt = trailerDict.get('Encrypt');
let encrypt;
try {
encrypt = trailerDict.get('Encrypt');
} catch (ex) {
if (ex instanceof MissingDataException) {
throw ex;
}
warn(`XRef.parse - Invalid "Encrypt" reference: "${ex}".`);
}
if (isDict(encrypt)) { if (isDict(encrypt)) {
var ids = trailerDict.get('ID'); var ids = trailerDict.get('ID');
var fileId = (ids && ids.length) ? ids[0] : ''; var fileId = (ids && ids.length) ? ids[0] : '';