1
0
mirror of https://github.com/bitwarden/desktop.git synced 2024-11-28 12:35:40 +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, appVersion: string,
updateRequest?: MenuUpdateRequest updateRequest?: MenuUpdateRequest
) { ) {
let isLocked = true;
if (
updateRequest != null &&
updateRequest.accounts != null &&
updateRequest.activeUserId != null
) {
isLocked = updateRequest.accounts[updateRequest.activeUserId]?.isLocked ?? true;
}
this.items = [ this.items = [
new BitwardenMenu( new BitwardenMenu(
i18nService, i18nService,
@ -60,28 +69,10 @@ export class Menubar {
windowMain.win, windowMain.win,
updateRequest?.accounts updateRequest?.accounts
), ),
new FileMenu( new FileMenu(i18nService, messagingService, isLocked),
i18nService, new EditMenu(i18nService, messagingService, isLocked),
messagingService, new ViewMenu(i18nService, messagingService, isLocked),
updateRequest?.accounts[updateRequest?.activeUserId]?.isLocked ?? true new AccountMenu(i18nService, messagingService, webVaultUrl, windowMain.win, isLocked),
),
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 WindowMenu(i18nService, messagingService, windowMain), new WindowMenu(i18nService, messagingService, windowMain),
new AboutMenu(i18nService, appVersion, windowMain.win, updaterMain), new AboutMenu(i18nService, appVersion, windowMain.win, updaterMain),
new HelpMenu(i18nService, webVaultUrl), new HelpMenu(i18nService, webVaultUrl),