Updates for 0.9.5
[debian/openrocket] / src / net / sf / openrocket / gui / adaptors / EnumModel.java
index f6e7d679a31cb4c6c4818618d5a9b22fdbdc4d90..20c459e78b61ec6fc1fa939f536b519332811249 100644 (file)
@@ -76,6 +76,10 @@ public class EnumModel<T extends Enum<T>> extends AbstractListModel
 
        @Override
        public void setSelectedItem(Object item) {
+               if (item == null) {
+                       // Clear selection - huh?
+                       return;
+               }
                if (item instanceof String) {
                        if (currentValue != null)
                                setMethod.invoke(source, (Object)null);
@@ -83,7 +87,7 @@ public class EnumModel<T extends Enum<T>> extends AbstractListModel
                }
                
                if (!(item instanceof Enum<?>)) {
-                       throw new IllegalArgumentException("Not String or Enum");
+                       throw new IllegalArgumentException("Not String or Enum, item="+item);
                }
                
                // Comparison with == ok, since both are enums