Skip to content

Commit 32508ef

Browse files
committed
Fix crash of extension when proxy settings address has wrong format
Signed-off-by: azerr <azerr@redhat.com>
1 parent 0b30585 commit 32508ef

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/settings/proxySettings.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export function getProxySettings(): ProxySettings {
7575
return null;
7676
}
7777
const regexResult = HOST_AND_PORT_EXTRACTOR.exec(proxyAddress);
78-
if (!regexResult[1]) {
78+
if (!regexResult || !regexResult[1]) {
7979
return null;
8080
}
8181
const host: string = regexResult[1];
@@ -152,7 +152,7 @@ export function jvmArgsContainsProxySettings(jvmArgs: string): boolean {
152152
);
153153
}
154154

155-
const HOST_AND_PORT_EXTRACTOR = /https?:\/\/([^:/]+)(?::([0-9]+))?/;
155+
const HOST_AND_PORT_EXTRACTOR = /(?:https?:\/\/)?([^:/]+)(?::([0-9]+))?/;
156156

157157
const JVM_PROXY_HOST = 'http.proxyHost';
158158
const JVM_PROXY_PORT = 'http.proxyPort';

0 commit comments

Comments
 (0)