mirror of
https://github.com/bitwarden/desktop.git
synced 2024-11-28 12:35:40 +01:00
null check windowMain.win
This commit is contained in:
parent
87fcaef587
commit
b66e1e8c83
@ -67,6 +67,10 @@ export class MenuMain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private initContextMenu() {
|
private initContextMenu() {
|
||||||
|
if (this.main.windowMain.win == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const selectionMenu = Menu.buildFromTemplate([
|
const selectionMenu = Menu.buildFromTemplate([
|
||||||
{ role: 'copy' },
|
{ role: 'copy' },
|
||||||
{ type: 'separator' },
|
{ type: 'separator' },
|
||||||
|
@ -62,6 +62,10 @@ export class MessagingMain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.syncTimeout = global.setTimeout(() => {
|
this.syncTimeout = global.setTimeout(() => {
|
||||||
|
if (this.main.windowMain.win == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.main.windowMain.win.webContents.send('messagingService', {
|
this.main.windowMain.win.webContents.send('messagingService', {
|
||||||
command: 'checkSyncVault',
|
command: 'checkSyncVault',
|
||||||
});
|
});
|
||||||
|
@ -28,6 +28,11 @@ export class UpdaterMain {
|
|||||||
|
|
||||||
autoUpdater.on('update-available', () => {
|
autoUpdater.on('update-available', () => {
|
||||||
if (this.doingUpdateCheckWithFeedback) {
|
if (this.doingUpdateCheckWithFeedback) {
|
||||||
|
if (this.main.windowMain.win == null) {
|
||||||
|
this.reset();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const result = dialog.showMessageBox(this.main.windowMain.win, {
|
const result = dialog.showMessageBox(this.main.windowMain.win, {
|
||||||
type: 'info',
|
type: 'info',
|
||||||
title: this.main.i18nService.t('updateAvailable'),
|
title: this.main.i18nService.t('updateAvailable'),
|
||||||
@ -48,7 +53,7 @@ export class UpdaterMain {
|
|||||||
});
|
});
|
||||||
|
|
||||||
autoUpdater.on('update-not-available', () => {
|
autoUpdater.on('update-not-available', () => {
|
||||||
if (this.doingUpdateCheckWithFeedback) {
|
if (this.doingUpdateCheckWithFeedback && this.main.windowMain.win != null) {
|
||||||
dialog.showMessageBox(this.main.windowMain.win, {
|
dialog.showMessageBox(this.main.windowMain.win, {
|
||||||
message: this.main.i18nService.t('noUpdatesAvailable'),
|
message: this.main.i18nService.t('noUpdatesAvailable'),
|
||||||
});
|
});
|
||||||
@ -60,6 +65,10 @@ export class UpdaterMain {
|
|||||||
autoUpdater.on('update-downloaded', (info) => {
|
autoUpdater.on('update-downloaded', (info) => {
|
||||||
this.main.menuMain.updateMenuItem.label = this.main.i18nService.t('restartToUpdate');
|
this.main.menuMain.updateMenuItem.label = this.main.i18nService.t('restartToUpdate');
|
||||||
|
|
||||||
|
if (this.main.windowMain.win == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const result = dialog.showMessageBox(this.main.windowMain.win, {
|
const result = dialog.showMessageBox(this.main.windowMain.win, {
|
||||||
type: 'info',
|
type: 'info',
|
||||||
title: this.main.i18nService.t('restartToUpdate'),
|
title: this.main.i18nService.t('restartToUpdate'),
|
||||||
|
@ -7,7 +7,9 @@ export class DesktopMainMessagingService implements MessagingService {
|
|||||||
|
|
||||||
send(subscriber: string, arg: any = {}) {
|
send(subscriber: string, arg: any = {}) {
|
||||||
const message = Object.assign({}, { command: subscriber }, arg);
|
const message = Object.assign({}, { command: subscriber }, arg);
|
||||||
this.main.windowMain.win.webContents.send('messagingService', message);
|
|
||||||
this.main.messagingMain.onMessage(message);
|
this.main.messagingMain.onMessage(message);
|
||||||
|
if (this.main.windowMain.win != null) {
|
||||||
|
this.main.windowMain.win.webContents.send('messagingService', message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user