Skip to content

Commit 2a422ba

Browse files
authored
Merge pull request DSpace#3004 from tdonohue/fix_3000
Fix `TypeError: Cannot read properties of undefined (reading 'userAgent')`
2 parents efdc357 + 9efcbb2 commit 2a422ba

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)