Skip to content

Commit 4a202f5

Browse files
committed
Safety for extreme proportions
1 parent 0276e3a commit 4a202f5

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/handlers/opusMagnum.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -722,6 +722,15 @@ export class opusMagnumITMHandler implements FormatHandler {
722722
this.#canvas.width = Math.floor(image.width*(max_canvas/image.height));
723723
this.#canvas.height = max_canvas;
724724
}
725+
726+
// Safety for extreme proportions (t.w.s.s.)
727+
if (this.#canvas.width < 1) {
728+
this.#canvas.width = 1;
729+
}
730+
if (this.#canvas.height < 1) {
731+
this.#canvas.height = 1;
732+
}
733+
725734
console.log("Image resized to "+this.#canvas.width+" "+this.#canvas.height);
726735
}
727736
else {

0 commit comments

Comments
 (0)