When the OK button in the component preset dialog is pressed without selecting an...
[debian/openrocket] / core / src / net / sf / openrocket / gui / dialogs / preset / ComponentPresetChooserDialog.java
index 8f5b1bbbf8268649cafeba913d6232839af7d40e..9efa3675e7a789c022b9ccfc809516ba02b46d41 100644 (file)
@@ -238,6 +238,10 @@ public class ComponentPresetChooserDialog extends JDialog {
                if (!okClicked)
                        return null;
                int row = componentSelectionTable.getSelectedRow();
+               if ( row < 0 ) {
+                       // Nothing selected.
+                       return null;
+               }
                row = componentSelectionTable.convertRowIndexToModel(row);
                return presets.get(row);
        }