Skip to content

Commit f728d02

Browse files
author
jantje
committed
Out of range error in linux whan starting the new skecth wizard
Seemingly there are cases where getselection index returns -1 Fixed by adding a max with 0
1 parent 19644cd commit f728d02

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

io.sloeber.ui/src/io/sloeber/ui/wizard/newsketch/NewSketchWizardCodeSelectionPage.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public void handleEvent(Event event) {
136136
* Checkbox settings
137137
*/
138138
protected void SetControls() {
139-
switch (CodeTypes.values()[this.mCodeSourceOptionsCombo.mCombo.getSelectionIndex()]) {
139+
switch (CodeTypes.values()[Math.max(0,this.mCodeSourceOptionsCombo.mCombo.getSelectionIndex())]) {
140140
case defaultIno:
141141
this.mTemplateFolderEditor.setEnabled(false, this.mParentComposite);
142142
this.mExampleEditor.setEnabled(false);
@@ -170,7 +170,7 @@ protected void validatePage() {
170170
if (this.mCodeSourceOptionsCombo == null) {
171171
return;
172172
}
173-
switch (CodeTypes.values()[this.mCodeSourceOptionsCombo.mCombo.getSelectionIndex()]) {
173+
switch (CodeTypes.values()[Math.max(0, this.mCodeSourceOptionsCombo.mCombo.getSelectionIndex())]) {
174174
case defaultIno:
175175
case defaultCPP:
176176
setPageComplete(true);// default always works

0 commit comments

Comments
 (0)