Merge pull request #13337 from Snuffleupagus/PredictorStream-super

[Regression] Move the `super`-call in the `PredictorStream`-constructor to prevent errors (PR 13303)
This commit is contained in:
calixteman 2021-05-05 13:58:21 +02:00 committed by GitHub
commit 52961197d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -19,10 +19,12 @@ import { isDict } from "./primitives.js";
class PredictorStream extends DecodeStream {
constructor(str, maybeLength, params) {
super(maybeLength);
if (!isDict(params)) {
return str; // no prediction
}
const predictor = params.get("Predictor") || 1;
const predictor = (this.predictor = params.get("Predictor") || 1);
if (predictor <= 1) {
return str; // no prediction
@ -30,8 +32,6 @@ class PredictorStream extends DecodeStream {
if (predictor !== 2 && (predictor < 10 || predictor > 15)) {
throw new FormatError(`Unsupported predictor: ${predictor}`);
}
super(maybeLength);
this.predictor = predictor;
if (predictor === 2) {
this.readBlock = this.readBlockTiff;