"item is null"

Tentatively fixes #1
This commit is contained in:
Nils Maier 2019-08-21 19:47:49 +02:00
parent f08d421768
commit 2d1a7eceb0

View File

@ -109,11 +109,14 @@ class Gatherer {
}
*collectImagesInternal(img: HTMLImageElement) {
try {
const src = img.currentSrc || img.src;
const item = this.makeItem(src, img);
if (item) {
item.fileName = "";
item.description = item.title;
yield item;
}
const {srcset} = img;
if (!srcset) {
@ -126,10 +129,16 @@ class Gatherer {
for (const i of imgs) {
const item = this.makeItem(i, img);
if (item) {
item.fileName = "";
item.description = item.title;
yield item;
}
}
}
catch (ex) {
console.error("oops image", ex.toString(), ex.stack, ex);
}
}
collectImages(img: HTMLImageElement) {
return [...this.collectImagesInternal(img)];