Skip to content

Commit 5687528

Browse files
author
Federico Fissore
committed
Fixed bug introduced by arduino#2628
1 parent 0094145 commit 5687528

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

app/src/processing/app/Editor.java

+8-4
Original file line numberDiff line numberDiff line change
@@ -967,13 +967,17 @@ protected void selectSerialPort(String name) {
967967
}
968968
JCheckBoxMenuItem selection = null;
969969
for (int i = 0; i < serialMenu.getItemCount(); i++) {
970-
JCheckBoxMenuItem item = ((JCheckBoxMenuItem)serialMenu.getItem(i));
971-
if (item == null) {
970+
JMenuItem menuItem = serialMenu.getItem(i);
971+
if (!(menuItem instanceof JCheckBoxMenuItem)) {
972+
continue;
973+
}
974+
JCheckBoxMenuItem checkBoxMenuItem = ((JCheckBoxMenuItem) menuItem);
975+
if (checkBoxMenuItem == null) {
972976
System.out.println(_("name is null"));
973977
continue;
974978
}
975-
item.setState(false);
976-
if (name.equals(item.getText())) selection = item;
979+
checkBoxMenuItem.setState(false);
980+
if (name.equals(checkBoxMenuItem.getText())) selection = checkBoxMenuItem;
977981
}
978982
if (selection != null) selection.setState(true);
979983
//System.out.println(item.getLabel());

0 commit comments

Comments
 (0)