Skip to content

Commit

Permalink
Fix crash of extension when proxy settings address has wrong format
Browse files Browse the repository at this point in the history
Signed-off-by: azerr <[email protected]>
  • Loading branch information
angelozerr authored and datho7561 committed Dec 12, 2024
1 parent 0b30585 commit f666928
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/settings/proxySettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export function getProxySettings(): ProxySettings {
return null;
}
const regexResult = HOST_AND_PORT_EXTRACTOR.exec(proxyAddress);
if (!regexResult[1]) {
if (!regexResult || !regexResult[1]) {
return null;
}
const host: string = regexResult[1];
Expand Down Expand Up @@ -152,7 +152,7 @@ export function jvmArgsContainsProxySettings(jvmArgs: string): boolean {
);
}

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

const JVM_PROXY_HOST = 'http.proxyHost';
const JVM_PROXY_PORT = 'http.proxyPort';
Expand Down

0 comments on commit f666928

Please sign in to comment.