From 6d529f8d25f6ac7a24765323958449a191aff950 Mon Sep 17 00:00:00 2001 From: kruland2607 Date: Wed, 29 Aug 2012 13:48:32 +0000 Subject: [PATCH] When the OK button in the component preset dialog is pressed without selecting an item, don't change the current preset for the component. This was reported as an IndexOutOfBounds exception. git-svn-id: https://openrocket.svn.sourceforge.net/svnroot/openrocket/trunk@1007 180e2498-e6e9-4542-8430-84ac67f01cd8 --- .../gui/dialogs/preset/ComponentPresetChooserDialog.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/src/net/sf/openrocket/gui/dialogs/preset/ComponentPresetChooserDialog.java b/core/src/net/sf/openrocket/gui/dialogs/preset/ComponentPresetChooserDialog.java index 8f5b1bbb..9efa3675 100644 --- a/core/src/net/sf/openrocket/gui/dialogs/preset/ComponentPresetChooserDialog.java +++ b/core/src/net/sf/openrocket/gui/dialogs/preset/ComponentPresetChooserDialog.java @@ -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); } -- 2.30.2