Use Image.prototype.decode only when src is already set

This commit is contained in:
ahocevar
2019-07-19 17:09:24 +02:00
parent ff063caa4e
commit 3cef9f2e00
2 changed files with 12 additions and 1 deletions

View File

@@ -159,7 +159,7 @@ class ImageWrapper extends ImageBase {
export function listenImage(image, loadHandler, errorHandler) {
const img = /** @type {HTMLImageElement} */ (image);
if (IMAGE_DECODE) {
if (img.src && IMAGE_DECODE) {
const promise = img.decode();
let listening = true;
const unlisten = function() {