From f66692877045eb72460987523d6b03686a4af9fb Mon Sep 17 00:00:00 2001 From: azerr Date: Wed, 11 Dec 2024 15:23:56 +0100 Subject: [PATCH] Fix crash of extension when proxy settings address has wrong format Signed-off-by: azerr --- src/settings/proxySettings.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/settings/proxySettings.ts b/src/settings/proxySettings.ts index 3cbcf386..46ebc155 100644 --- a/src/settings/proxySettings.ts +++ b/src/settings/proxySettings.ts @@ -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]; @@ -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';