1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-24 12:06:15 +01:00

Fix null ref when building/updating the MenuBar (#1227)

This commit is contained in:
Daniel James Smith 2022-01-12 15:19:18 +01:00 committed by GitHub
parent f6f0bd2bfb
commit 2b64ec5375
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -52,6 +52,15 @@ export class Menubar {
appVersion: string,
updateRequest?: MenuUpdateRequest
) {
let isLocked = true;
if (
updateRequest != null &&
updateRequest.accounts != null &&
updateRequest.activeUserId != null
) {
isLocked = updateRequest.accounts[updateRequest.activeUserId]?.isLocked ?? true;
}
this.items = [
new BitwardenMenu(
i18nService,
@ -60,28 +69,10 @@ export class Menubar {
windowMain.win,
updateRequest?.accounts
),
new FileMenu(
i18nService,
messagingService,
updateRequest?.accounts[updateRequest?.activeUserId]?.isLocked ?? true
),
new EditMenu(
i18nService,
messagingService,
updateRequest?.accounts[updateRequest?.activeUserId]?.isLocked ?? true
),
new ViewMenu(
i18nService,
messagingService,
updateRequest?.accounts[updateRequest?.activeUserId]?.isLocked ?? true
),
new AccountMenu(
i18nService,
messagingService,
webVaultUrl,
windowMain.win,
updateRequest?.accounts[updateRequest?.activeUserId]?.isLocked ?? true
),
new FileMenu(i18nService, messagingService, isLocked),
new EditMenu(i18nService, messagingService, isLocked),
new ViewMenu(i18nService, messagingService, isLocked),
new AccountMenu(i18nService, messagingService, webVaultUrl, windowMain.win, isLocked),
new WindowMenu(i18nService, messagingService, windowMain),
new AboutMenu(i18nService, appVersion, windowMain.win, updaterMain),
new HelpMenu(i18nService, webVaultUrl),