Skip to content

Commit 503b9bc

Browse files
committed
fix: null reference error for compose files containing future tags
1 parent 3fc8acd commit 503b9bc

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/lib/docker-utils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ export async function getImageUpdateTags(credentialsStore: CredentialsStore, doc
188188

189189
if(dockerImage.tag && semver.valid(dockerImage.tag)) {
190190
wanted = semver.maxSatisfying(validTags, `^${dockerImage.tag}`);
191+
if(!wanted) wanted = dockerImage.tag;
191192
}
192193
}
193194

src/lib/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,11 @@ export async function listOutdated(options: Options): Promise<OutdatedImage[]> {
9797

9898
try {
9999
for (const image of filteredImages) {
100+
100101
const {latest, wanted} = await getImageUpdateTags(credentials, image);
101-
102-
const wantedDiff = semver.diff(image.tag, wanted);
103-
const latestDiff = semver.diff(image.tag, latest);
102+
103+
const wantedDiff = wanted && semver.diff(image.tag, wanted);
104+
const latestDiff = latest && semver.diff(image.tag, latest);
104105
if (wantedDiff || latestDiff) {
105106
outdatedImages.push({
106107
image,

0 commit comments

Comments
 (0)