null check windowMain.win
This commit is contained in:
parent
87fcaef587
commit
b66e1e8c83
|
@ -67,6 +67,10 @@ export class MenuMain {
|
|||
}
|
||||
|
||||
private initContextMenu() {
|
||||
if (this.main.windowMain.win == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
const selectionMenu = Menu.buildFromTemplate([
|
||||
{ role: 'copy' },
|
||||
{ type: 'separator' },
|
||||
|
|
|
@ -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',
|
||||
});
|
||||
|
|
|
@ -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'),
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue