mirror of
https://github.com/Microsoft/vscode
synced 2024-09-19 02:26:04 +00:00
dialogs - do not allow cancelId
to point to a button that does not exist
This commit is contained in:
parent
226124eda3
commit
272d1af97f
|
@ -495,9 +495,9 @@ export class Dialog extends Disposable {
|
|||
buttonMap.push({ label: button, index });
|
||||
});
|
||||
|
||||
// macOS/linux: reverse button order
|
||||
// macOS/linux: reverse button order if `cancelId` is defined
|
||||
if (isMacintosh || isLinux) {
|
||||
if (cancelId !== undefined) {
|
||||
if (cancelId !== undefined && cancelId < buttons.length) {
|
||||
const cancelButton = buttonMap.splice(cancelId, 1)[0];
|
||||
buttonMap.reverse();
|
||||
buttonMap.splice(buttonMap.length - 1, 0, cancelButton);
|
||||
|
|
Loading…
Reference in a new issue