[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:
11
src/main.js
11
src/main.js
@@ -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) {
|
||||
|
Reference in New Issue
Block a user