[MM-18936] Guard against bad server url so app doesn't crash (#1049)

* guard against invalid server url so app doesn't crash

* move if statement and add try/catch
This commit is contained in:
Michael Kochell
2019-10-01 12:17:08 -06:00
committed by GitHub
parent a5368a9587
commit 593ded98f6

View File

@@ -764,10 +764,19 @@ function handleMainWindowWebContentsCrashed() {
//
function isTrustedURL(url) {
if (!url) {
return false;
}
let parsedUrl = url;
if (typeof url === 'string') {
parsedUrl = new URL(url);
try {
parsedUrl = new URL(url);
} catch (e) {
return false;
}
}
const trustedURLs = config.teams.map((team) => new URL(team.url));
for (const trustedURL of trustedURLs) {