[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 <hyangah@gmail.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Suzy Mueller <suzmue@golang.org>
(cherry picked from commit feee65b4e865ff395e0a6b1de2bb29e3155ec91c)
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/290109
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
diff --git a/src/goMain.ts b/src/goMain.ts
index 3788344..8e6f203 100644
--- a/src/goMain.ts
+++ b/src/goMain.ts
@@ -603,6 +603,9 @@
}
const coercedNew = semver.coerce(newVersion);
const coercedOld = semver.coerce(oldVersion);
+ if (!coercedNew || !coercedOld) {
+ return true;
+ }
// Both semver.coerce(0.22.0) and semver.coerce(0.22.0-rc.1) will be 0.22.0.
return semver.gte(coercedNew, coercedOld) && showVersions.includes(coercedNew.toString());
}