Skip to content

Commit 9efcbb2

Browse files
committed
Fix bug where "navigator" may be null in SSR mode
1 parent 054043a commit 9efcbb2

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/app/root/root.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ export class RootComponent implements OnInit {
144144
}
145145

146146
getBrowserName(): string {
147-
const userAgent = this._window.nativeWindow.navigator.userAgent;
147+
const userAgent = this._window.nativeWindow.navigator?.userAgent;
148148
if (/Firefox/.test(userAgent)) {
149149
return 'firefox';
150150
}
@@ -155,7 +155,7 @@ export class RootComponent implements OnInit {
155155
}
156156

157157
getOSName(): string {
158-
const userAgent = this._window.nativeWindow.navigator.userAgent;
158+
const userAgent = this._window.nativeWindow.navigator?.userAgent;
159159
if (/Windows/.test(userAgent)) {
160160
return 'windows';
161161
}

0 commit comments

Comments
 (0)