From 9efcbb20a48e6fdc63551baa63cabc915ce36424 Mon Sep 17 00:00:00 2001 From: Tim Donohue Date: Fri, 3 May 2024 09:38:02 -0500 Subject: [PATCH] Fix bug where "navigator" may be null in SSR mode --- src/app/root/root.component.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/root/root.component.ts b/src/app/root/root.component.ts index e93a7b5c527..c683899211c 100644 --- a/src/app/root/root.component.ts +++ b/src/app/root/root.component.ts @@ -144,7 +144,7 @@ export class RootComponent implements OnInit { } getBrowserName(): string { - const userAgent = this._window.nativeWindow.navigator.userAgent; + const userAgent = this._window.nativeWindow.navigator?.userAgent; if (/Firefox/.test(userAgent)) { return 'firefox'; } @@ -155,7 +155,7 @@ export class RootComponent implements OnInit { } getOSName(): string { - const userAgent = this._window.nativeWindow.navigator.userAgent; + const userAgent = this._window.nativeWindow.navigator?.userAgent; if (/Windows/.test(userAgent)) { return 'windows'; }