Merge pull request #3004 from tdonohue/fix_3000

Fix `TypeError: Cannot read properties of undefined (reading 'userAgent')`
This commit is contained in:
Tim Donohue
2024-05-03 10:19:41 -05:00
committed by GitHub

View File

@@ -144,7 +144,7 @@ export class RootComponent implements OnInit {
} }
getBrowserName(): string { getBrowserName(): string {
const userAgent = this._window.nativeWindow.navigator.userAgent; const userAgent = this._window.nativeWindow.navigator?.userAgent;
if (/Firefox/.test(userAgent)) { if (/Firefox/.test(userAgent)) {
return 'firefox'; return 'firefox';
} }
@@ -155,7 +155,7 @@ export class RootComponent implements OnInit {
} }
getOSName(): string { getOSName(): string {
const userAgent = this._window.nativeWindow.navigator.userAgent; const userAgent = this._window.nativeWindow.navigator?.userAgent;
if (/Windows/.test(userAgent)) { if (/Windows/.test(userAgent)) {
return 'windows'; return 'windows';
} }