Check if user cancelled before making image
authoramwaterhouse <Andrew Waterhouse>
Mon, 12 Dec 2005 13:31:29 +0000 (13:31 +0000)
committeramwaterhouse <Andrew Waterhouse>
Mon, 12 Dec 2005 13:31:29 +0000 (13:31 +0000)
src/jalview/util/ImageMaker.java

index 02427f2..59244eb 100755 (executable)
@@ -49,19 +49,22 @@ public class ImageMaker
       }\r
     }\r
 \r
-    try\r
+    if(file!=null)\r
     {\r
-      out = new FileOutputStream(file);\r
+      try\r
+      {\r
+        out = new FileOutputStream(file);\r
 \r
-      if (type == EPS)\r
-        setupEPS(width, height, EPStitle);\r
-      else\r
-        setupPNG(width, height);\r
-    }\r
-    catch (Exception ex)\r
-    {\r
-      System.out.println("Error creating " + (type == EPS ? "EPS" : "PNG") +\r
-                         " file.");\r
+        if (type == EPS)\r
+          setupEPS(width, height, EPStitle);\r
+        else\r
+          setupPNG(width, height);\r
+      }\r
+      catch (Exception ex)\r
+      {\r
+        System.out.println("Error creating " + (type == EPS ? "EPS" : "PNG") +\r
+                           " file.");\r
+      }\r
     }\r
   }\r
 \r