From a09177d38b86a3343a4cfca02de58a103bb2b112 Mon Sep 17 00:00:00 2001 From: sam <76621625+saemik94@users.noreply.github.com> Date: Wed, 19 Jul 2023 19:48:41 +0200 Subject: [PATCH] fix: prevent splitting on an undefined value (#247) --- widgets/images/imageList.widget.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/widgets/images/imageList.widget.js b/widgets/images/imageList.widget.js index 1c6cc94..a82e0e0 100644 --- a/widgets/images/imageList.widget.js +++ b/widgets/images/imageList.widget.js @@ -45,11 +45,11 @@ class myWidget extends ListWidget { if (images) { images.forEach((image) => { - const getTag = (tag, part) => tag ? tag[0].split(':')[part] : 'none' + const getTag = (tag, part) => (tag && tag.length) ? tag[0].split(':')[part] : 'none' imageList.push([ image.Id.substring(7, 12), - image.RepoDigests ? image.RepoDigests[0].split('@')[0] : getTag(image[2], 0), + (image.RepoDigests && image.RepoDigests.length) ? image.RepoDigests[0].split('@')[0] : getTag(image[2], 0), getTag(image.RepoTags, 1), this.timeDifference(image.Created), this.formatBytes(image.Size)