1
0
mirror of https://github.com/bitwarden/desktop.git synced 2024-06-25 10:26:00 +02:00

null check windowMain.win

This commit is contained in:
Kyle Spearrin 2018-02-16 09:59:03 -05:00
parent 87fcaef587
commit b66e1e8c83
4 changed files with 21 additions and 2 deletions

View File

@ -67,6 +67,10 @@ export class MenuMain {
}
private initContextMenu() {
if (this.main.windowMain.win == null) {
return;
}
const selectionMenu = Menu.buildFromTemplate([
{ role: 'copy' },
{ type: 'separator' },

View File

@ -62,6 +62,10 @@ export class MessagingMain {
}
this.syncTimeout = global.setTimeout(() => {
if (this.main.windowMain.win == null) {
return;
}
this.main.windowMain.win.webContents.send('messagingService', {
command: 'checkSyncVault',
});

View File

@ -28,6 +28,11 @@ export class UpdaterMain {
autoUpdater.on('update-available', () => {
if (this.doingUpdateCheckWithFeedback) {
if (this.main.windowMain.win == null) {
this.reset();
return;
}
const result = dialog.showMessageBox(this.main.windowMain.win, {
type: 'info',
title: this.main.i18nService.t('updateAvailable'),
@ -48,7 +53,7 @@ export class UpdaterMain {
});
autoUpdater.on('update-not-available', () => {
if (this.doingUpdateCheckWithFeedback) {
if (this.doingUpdateCheckWithFeedback && this.main.windowMain.win != null) {
dialog.showMessageBox(this.main.windowMain.win, {
message: this.main.i18nService.t('noUpdatesAvailable'),
});
@ -60,6 +65,10 @@ export class UpdaterMain {
autoUpdater.on('update-downloaded', (info) => {
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, {
type: 'info',
title: this.main.i18nService.t('restartToUpdate'),

View File

@ -7,7 +7,9 @@ export class DesktopMainMessagingService implements MessagingService {
send(subscriber: string, arg: any = {}) {
const message = Object.assign({}, { command: subscriber }, arg);
this.main.windowMain.win.webContents.send('messagingService', message);
this.main.messagingMain.onMessage(message);
if (this.main.windowMain.win != null) {
this.main.windowMain.win.webContents.send('messagingService', message);
}
}
}