From 56875283256870011a3ee6d27f4f4370519713ec Mon Sep 17 00:00:00 2001 From: Federico Fissore Date: Fri, 13 Feb 2015 15:30:43 +0100 Subject: [PATCH] Fixed bug introduced by #2628 --- app/src/processing/app/Editor.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/src/processing/app/Editor.java b/app/src/processing/app/Editor.java index 3794c0f2a..0e52ad9ba 100644 --- a/app/src/processing/app/Editor.java +++ b/app/src/processing/app/Editor.java @@ -967,13 +967,17 @@ public class Editor extends JFrame implements RunnerListener { } JCheckBoxMenuItem selection = null; for (int i = 0; i < serialMenu.getItemCount(); i++) { - JCheckBoxMenuItem item = ((JCheckBoxMenuItem)serialMenu.getItem(i)); - if (item == null) { + JMenuItem menuItem = serialMenu.getItem(i); + if (!(menuItem instanceof JCheckBoxMenuItem)) { + continue; + } + JCheckBoxMenuItem checkBoxMenuItem = ((JCheckBoxMenuItem) menuItem); + if (checkBoxMenuItem == null) { System.out.println(_("name is null")); continue; } - item.setState(false); - if (name.equals(item.getText())) selection = item; + checkBoxMenuItem.setState(false); + if (name.equals(checkBoxMenuItem.getText())) selection = checkBoxMenuItem; } if (selection != null) selection.setState(true); //System.out.println(item.getLabel());