[Bug] Cannot read property 'webContents' of null
yafp opened this issue · comments
via sentry: MEDIA-DUPES-JB - https://sentry.io/organizations/yafp/issues/1581597457/
TypeError PowerMonitor.(main)
fatalCannot read property 'webContents' of null
...
app:///main.js in PowerMonitor. at line 896:20
*/
function powerMonitorInit () {
const { powerMonitor } = require('electron') // This module cannot be used until the ready event of the app module is emitted.
// suspend
powerMonitor.on('suspend', () => {
doLog('warn', 'powerMonitorInit ::: The system is going to sleep (event: suspend)')
mainWindow.webContents.send('todoListTryToSave') // try to save the todolist - see #79
powerMonitorNotify('warning', 'The system is going to sleep (event: suspend)', 0)
})
// resume
powerMonitor.on('resume', () => {
doLog('info', 'powerMonitorInit ::: The system is resuming (event: resume)')
mainWindow.webContents.send('todoListCheck') // search if there are urls to restore