Skip to content

Commit ea76c49

Browse files
committed
[release] src/goMain: fix the exception caused by invalid version string
https://go-review.googlesource.com/c/vscode-go/+/289191 made showGoWelcomePage pass an empty string to shouldShowGoWelcomePage and causes it to fail. Do the null check on the coerced semver. Change-Id: Ibc5d9684e153571e7e6507f533367a128952c9ac Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/289969 Run-TryBot: Hyang-Ah Hana Kim <[email protected]> TryBot-Result: kokoro <[email protected]> Trust: Hyang-Ah Hana Kim <[email protected]> Reviewed-by: Suzy Mueller <[email protected]> (cherry picked from commit feee65b) Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/290109 Reviewed-by: Rebecca Stambler <[email protected]>
1 parent b33ce83 commit ea76c49

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/goMain.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,9 @@ export function shouldShowGoWelcomePage(showVersions: string[], newVersion: stri
603603
}
604604
const coercedNew = semver.coerce(newVersion);
605605
const coercedOld = semver.coerce(oldVersion);
606+
if (!coercedNew || !coercedOld) {
607+
return true;
608+
}
606609
// Both semver.coerce(0.22.0) and semver.coerce(0.22.0-rc.1) will be 0.22.0.
607610
return semver.gte(coercedNew, coercedOld) && showVersions.includes(coercedNew.toString());
608611
}

0 commit comments

Comments
 (0)