Skip to content

Commit 6fc6e4b

Browse files
authored
0.6.1: fix error cannot read property 'replace' of undefined. (#164)
Signed-off-by: Yan Zhang <[email protected]>
1 parent c1b6842 commit 6fc6e4b

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Change Log
22
All notable changes to the "vscode-spring-initializr" extension will be documented in this file.
33

4+
## 0.6.1
5+
- Fix Error: Cannot read property 'split' of undefined. [#162](https://github.com/microsoft/vscode-spring-initializr/issues/162#issuecomment-726832226)
6+
47
## 0.6.0
58
- Allow commands to start initializr wizard with default selections.
69
- Add a new setting `spring.initializr.defaultOpenProjectMethod` for default project opening method.

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "vscode-spring-initializr",
33
"displayName": "Spring Initializr Java Support",
44
"description": "A lightweight extension based on Spring Initializr to generate quick start Spring Boot Java projects.",
5-
"version": "0.6.0",
5+
"version": "0.6.1",
66
"icon": "resources/logo.png",
77
"publisher": "vscjava",
88
"aiKey": "05fb8871-fbf0-488f-8453-a74cf0ca9b93",

src/Utils/VersionHelper.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,16 @@ export function compareVersions(a: string, b: string): number {
5656
return result;
5757
}
5858
}
59-
const aqual: string = parseQualifier(versionA[3]);
60-
const bqual: string = parseQualifier(versionB[3]);
59+
// version[3] can be undefined
60+
const aqualRaw: string = versionA[3] || "RELEASE";
61+
const bqualRaw: string = versionB[3] || "RELEASE";
62+
const aqual: string = parseQualifier(aqualRaw);
63+
const bqual: string = parseQualifier(bqualRaw);
6164
result = qualifiers.indexOf(aqual) - qualifiers.indexOf(bqual);
6265
if (result !== 0) {
6366
return result;
6467
}
65-
return versionA[3].localeCompare(versionB[3]);
68+
return aqualRaw.localeCompare(bqualRaw);
6669
}
6770

6871
function parseQualifier(version: string): string {

0 commit comments

Comments
 (0)