Skip to content

Commit

Permalink
Fix bug where "navigator" may be null in SSR mode
Browse files Browse the repository at this point in the history
  • Loading branch information
tdonohue committed May 3, 2024
1 parent 054043a commit 9efcbb2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/app/root/root.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
Expand All @@ -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';
}
Expand Down

0 comments on commit 9efcbb2

Please sign in to comment.