Fix images[0] undefined issue
Sometimes images is present but empty.
This commit is contained in:
@@ -49,11 +49,13 @@ const ext = {
|
|||||||
api.addEventListener("executed", ({ detail }) => {
|
api.addEventListener("executed", ({ detail }) => {
|
||||||
if (!enabled) return;
|
if (!enabled) return;
|
||||||
const images = detail?.output?.images;
|
const images = detail?.output?.images;
|
||||||
if (!images) return;
|
if (!images || !images.length) return;
|
||||||
const format = app.getPreviewFormatParam();
|
const format = app.getPreviewFormatParam();
|
||||||
const src = `/view?filename=${encodeURIComponent(images[0].filename)}&type=${
|
const src = [
|
||||||
images[0].type
|
`/view?filename=${encodeURIComponent(images[0].filename)}`,
|
||||||
}&subfolder=${encodeURIComponent(images[0].subfolder)}&t=${+new Date()}${format}`;
|
`type=${images[0].type}`,
|
||||||
|
`subfolder=${encodeURIComponent(images[0].subfolder)}`,
|
||||||
|
`t=${+new Date()}${format}`,].join('&');
|
||||||
show(src, detail.node);
|
show(src, detail.node);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user