fix for JAL-1438
authorJim Procter <jprocter@dundee.ac.uk>
Mon, 21 Apr 2014 17:13:56 +0000 (18:13 +0100)
committerJim Procter <jprocter@dundee.ac.uk>
Mon, 21 Apr 2014 17:13:56 +0000 (18:13 +0100)
src/jalview/io/JalviewFileChooser.java

index e9651ad..46ecf41 100755 (executable)
@@ -215,22 +215,24 @@ public class JalviewFileChooser extends JFileChooser
     return ret;
   }
 
-  void recentListSelectionChanged(String selection)
+  void recentListSelectionChanged(Object selection)
   {
     setSelectedFile(null);
-
-    File file = new File(selection);
-    if (getFileFilter() instanceof JalviewFileFilter)
+    if (selection != null)
     {
-      JalviewFileFilter jvf = (JalviewFileFilter) this.getFileFilter();
-
-      if (!jvf.accept(file))
+      File file = new File((String) selection);
+      if (getFileFilter() instanceof JalviewFileFilter)
       {
-        setFileFilter(getChoosableFileFilters()[0]);
+        JalviewFileFilter jvf = (JalviewFileFilter) this.getFileFilter();
+
+        if (!jvf.accept(file))
+        {
+          setFileFilter(getChoosableFileFilters()[0]);
+        }
       }
-    }
 
-    setSelectedFile(file);
+      setSelectedFile(file);
+    }
   }
 
   class RecentlyOpened extends JPanel
@@ -263,7 +265,7 @@ public class JalviewFileChooser extends JFileChooser
       {
         public void mousePressed(MouseEvent evt)
         {
-          recentListSelectionChanged(list.getSelectedValue().toString());
+          recentListSelectionChanged(list.getSelectedValue());
         }
       });