fix: crash when dialog.showMessageBoxSync with missing buttons (#40996)

* fix: crash when dialog.showMessageBoxSync missing buttons

* chore: feedback from review
This commit is contained in:
Shelley Vohr 2024-01-18 13:21:15 +01:00 committed by GitHub
parent df7f07a8af
commit 7e6fb97a2f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 25 additions and 8 deletions

View file

@ -146,6 +146,22 @@ describe('dialog module', () => {
expect(result.response).to.equal(0);
});
it('does not crash when there is a defaultId but no buttons', async () => {
const controller = new AbortController();
const signal = controller.signal;
const w = new BrowserWindow();
const p = dialog.showMessageBox(w, {
signal,
message: 'i am message',
type: 'info',
defaultId: 0,
title: 'i am title'
});
controller.abort();
const result = await p;
expect(result.response).to.equal(0);
});
it('cancels message box', async () => {
const controller = new AbortController();
const signal = controller.signal;