lightbox_canvas: Return from sizeCanvas() if parentNode is null.

The value of `canvas.parentNode` in `sizeCanvas()`
appears to be `null` sometimes and it throwed an
exception specially when you switch images from
the images-list quickly.
This commit is contained in:
Hashir Sarwar
2020-04-04 15:07:14 +05:00
committed by Tim Abbott
parent 8686bbf637
commit 2a80f4109a

View File

@@ -229,6 +229,10 @@ const funcs = {
// means that the height is less than 100% of the parent height. If so,
// then we size the photo as w = 100%, h = 100% / 1.5.
sizeCanvas: function (canvas, meta) {
if (canvas.parentNode === null) {
return;
}
if (typeof meta.onresize === "function") {
meta.onresize(canvas);
}