fix: handle potential missing close event property (#46605)

fix: handle missing close event property
This commit is contained in:
Shelley Vohr 2025-04-11 19:07:26 +02:00 committed by GitHub
parent a9b2ec514b
commit 62b5b5f99d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -54,7 +54,7 @@ BrowserWindow.prototype._init = function (this: BWT) {
});
this.on('close', (event) => {
queueMicrotask(() => {
if (!unresponsiveEvent && !event.defaultPrevented) {
if (!unresponsiveEvent && !event?.defaultPrevented) {
unresponsiveEvent = setTimeout(emitUnresponsiveEvent, 5000);
}
});