hotfix: fix Cannot read properties of undefined (reading 'removeChild')

This commit is contained in:
JellyBrick
2023-10-16 01:08:41 +09:00
parent bfe4b2bba7
commit d78fbe476e

View File

@ -138,12 +138,16 @@ export default async () => {
ipcRenderer.on('refreshMenu', () => updateMenu()); ipcRenderer.on('refreshMenu', () => updateMenu());
ipcRenderer.on('window-maximize', () => { ipcRenderer.on('window-maximize', () => {
maximizeButton.removeChild(maximizeButton.firstChild!); if (isNotWindowsOrMacOS && maximizeButton.firstChild) {
maximizeButton.appendChild(unmaximize); maximizeButton.removeChild(maximizeButton.firstChild);
maximizeButton.appendChild(unmaximize);
}
}); });
ipcRenderer.on('window-unmaximize', () => { ipcRenderer.on('window-unmaximize', () => {
maximizeButton.removeChild(maximizeButton.firstChild!); if (isNotWindowsOrMacOS && maximizeButton.firstChild) {
maximizeButton.appendChild(maximize); maximizeButton.removeChild(maximizeButton.firstChild);
maximizeButton.appendChild(unmaximize);
}
}); });
if (isEnabled('picture-in-picture')) { if (isEnabled('picture-in-picture')) {