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:
parent
51b0e60f9b
commit
2d51bce941
@ -424,8 +424,7 @@ var PDFDocument = (function PDFDocumentClosure() {
|
|||||||
},
|
},
|
||||||
|
|
||||||
get linearization() {
|
get linearization() {
|
||||||
var linearization = null;
|
let linearization = null;
|
||||||
if (this.stream.length) {
|
|
||||||
try {
|
try {
|
||||||
linearization = Linearization.create(this.stream);
|
linearization = Linearization.create(this.stream);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@ -434,7 +433,6 @@ var PDFDocument = (function PDFDocumentClosure() {
|
|||||||
}
|
}
|
||||||
info(err);
|
info(err);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// shadow the prototype getter with a data property
|
// shadow the prototype getter with a data property
|
||||||
return shadow(this, 'linearization', linearization);
|
return shadow(this, 'linearization', linearization);
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user