Remove unnecessary stream.length check from PDFDocument.linearization

Note first of all that `PDFDocument` will be initialized with either a `Stream` or a `ChunkedStream`, and that both of these have `length` getters. Secondly, the `PDFDocument` constructor will assert that the `stream` has a non-zero (and positive) length. Hence there's no point in checking `stream.length` in the `linearization` getter.
This commit is contained in:
Jonas Jenwald 2018-07-24 14:31:06 +02:00
parent 51b0e60f9b
commit 2d51bce941

View File

@ -424,16 +424,14 @@ var PDFDocument = (function PDFDocumentClosure() {
},
get linearization() {
var linearization = null;
if (this.stream.length) {
try {
linearization = Linearization.create(this.stream);
} catch (err) {
if (err instanceof MissingDataException) {
throw err;
}
info(err);
let linearization = null;
try {
linearization = Linearization.create(this.stream);
} catch (err) {
if (err instanceof MissingDataException) {
throw err;
}
info(err);
}
// shadow the prototype getter with a data property
return shadow(this, 'linearization', linearization);