Further tweaks to get tests passing
[jalview.git] / src / jalview / gui / Preferences.java
index 1ac17e4..4f4dcd0 100755 (executable)
@@ -24,6 +24,7 @@ import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
 import jalview.bin.Cache;
 import jalview.gui.Help.HelpId;
 import jalview.gui.StructureViewer.ViewerType;
+import jalview.io.FileFormatI;
 import jalview.io.JalviewFileChooser;
 import jalview.io.JalviewFileView;
 import jalview.jbgui.GPreferences;
@@ -699,9 +700,12 @@ public class Preferences extends GPreferences
 
     if (value == JalviewFileChooser.APPROVE_OPTION)
     {
-      Cache.applicationProperties.setProperty("DEFAULT_FILE_FORMAT",
-              chooser
-                      .getSelectedFormat().toString());
+      FileFormatI format = chooser.getSelectedFormat();
+      if (format != null)
+      {
+        Cache.applicationProperties.setProperty("DEFAULT_FILE_FORMAT",
+                format.toString());
+      }
       startupFileTextfield.setText(chooser.getSelectedFile()
               .getAbsolutePath());
     }