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

fix: handle missing close event property

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
trop[bot] 2025-04-11 15:29:32 -04:00 committed by GitHub
parent b518e4ad36
commit a2ee5547e0
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);
}
});