From 2bc7c42733a4b969b6aaee10d74814f40ff8e9a1 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 22 Aug 2018 08:37:52 -0400 Subject: [PATCH] catch security errors on ie when reading hostname --- src/misc/utils.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/misc/utils.ts b/src/misc/utils.ts index 3e3f3c0b43..ca134770b1 100644 --- a/src/misc/utils.ts +++ b/src/misc/utils.ts @@ -145,12 +145,20 @@ export class Utils { static getHostname(uriString: string): string { const url = Utils.getUrl(uriString); - return url != null ? url.hostname : null; + try { + return url != null ? url.hostname : null; + } catch { + return null; + } } static getHost(uriString: string): string { const url = Utils.getUrl(uriString); - return url != null ? url.host : null; + try { + return url != null ? url.host : null; + } catch { + return null; + } } static getQueryParams(uriString: string): Map {