fix: electron windowTracker error when reloading and killing scripts

This commit is contained in:
smolgumball 2022-01-29 17:58:09 -07:00
parent 9ddb1c4379
commit 3431997315

@ -29,6 +29,11 @@ const windowTracker = (windowName) => {
}; };
const saveState = debounce(() => { const saveState = debounce(() => {
if (!window || window.isDestroyed()) {
log.silly(`Saving window state failed because window is not available`);
return;
}
if (!windowState.isMaximized) { if (!windowState.isMaximized) {
windowState = window.getBounds(); windowState = window.getBounds();
} }
@ -41,7 +46,7 @@ const windowTracker = (windowName) => {
const track = (win) => { const track = (win) => {
window = win; window = win;
['resize', 'move', 'close'].forEach((event) => { ["resize", "move", "close"].forEach((event) => {
win.on(event, saveState); win.on(event, saveState);
}); });
}; };