From 95101bf3f6d00105621cdddb639ea62b95ea2468 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Fri, 6 Apr 2018 10:22:08 +0200 Subject: [PATCH] Revert "SelectBox: Add bounds checking on selected option. Addresses: #43475, #44309 (#47044)" This reverts commit 043538eeb07fc8854d97d3abaed378b28240b804. --- .../browser/ui/selectBox/selectBoxCustom.ts | 18 +----------------- .../browser/ui/selectBox/selectBoxNative.ts | 12 +----------- 2 files changed, 2 insertions(+), 28 deletions(-) diff --git a/src/vs/base/browser/ui/selectBox/selectBoxCustom.ts b/src/vs/base/browser/ui/selectBox/selectBoxCustom.ts index 3e11ab520f9..286bfeb835f 100644 --- a/src/vs/base/browser/ui/selectBox/selectBoxCustom.ts +++ b/src/vs/base/browser/ui/selectBox/selectBoxCustom.ts @@ -229,17 +229,7 @@ export class SelectBoxList implements ISelectBoxDelegate, IDelegate= 0 && selected < this.options.length) { - this.select(selected); - } else if (selected > this.options.length - 1) { - // This could make client out of sync with the select - this.select(this.options.length - 1); - console.error('selectBoxCustom: setOptions selected exceeds options length'); - } else if (selected < 0) { - this.selected = 0; - } + this.select(selected); } } @@ -363,12 +353,6 @@ export class SelectBoxList implements ISelectBoxDelegate, IDelegate this.options.length - 1 || !this.selectList.length) { - console.error('selectBoxCustom: showSelectDropDown this.select exceeds options length or empty list'); - return; - } - this._isVisible = true; this.cloneElementFont(this.selectElement, this.selectDropDownContainer); this.contextViewProvider.showContextView({ diff --git a/src/vs/base/browser/ui/selectBox/selectBoxNative.ts b/src/vs/base/browser/ui/selectBox/selectBoxNative.ts index a04587b8685..2f8f0184182 100644 --- a/src/vs/base/browser/ui/selectBox/selectBoxNative.ts +++ b/src/vs/base/browser/ui/selectBox/selectBoxNative.ts @@ -84,17 +84,7 @@ export class SelectBoxNative implements ISelectBoxDelegate { } if (selected !== undefined) { - // Guard against out of bounds selected values - // Cannot currently return error, set selected within range - if (selected >= 0 && selected < this.options.length) { - this.select(selected); - } else if (selected > this.options.length - 1) { - // This could make client out of sync with the select - this.select(this.options.length - 1); - console.error('selectBoxNative: setOptions selected exceeds options length'); - } else if (selected < 0) { - this.selected = 0; - } + this.select(selected); } } -- GitLab