Merge branch threads into development
[Mograsim.git] / plugins / net.mograsim.logic.model / src / net / mograsim / logic / model / LogicUICanvas.java
index fe6c14c..5fd58c1 100644 (file)
@@ -160,8 +160,9 @@ public class LogicUICanvas extends ZoomableCanvas
                {
                        try
                        {
-                               if (componentSelector.getSelectionIndex() >= componentsByItemIndex.size())
-                                       throw new RuntimeException("No valid component selected");
+                               int componentIndex = componentSelector.getSelectionIndex();
+                               if (componentIndex < 0 || componentIndex >= componentsByItemIndex.size())
+                                       throw new RuntimeException("No component selected");
                                output.setText("Success! Value: \r\n"
                                                + componentsByItemIndex.get(componentSelector.getSelectionIndex()).getHighLevelState(stateIDText.getText()));
                        }