JAL-629 Fix Exceptions when running with CLI not headless
[jalview.git] / src / jalview / gui / JvOptionPane.java
index 3c942ce..020890b 100644 (file)
@@ -1066,9 +1066,12 @@ public class JvOptionPane extends JOptionPane
 
     ourOptions = Arrays.asList(options);
     int response;
-    if (parentComponent != this)
+    if (parentComponent != this
+            && !(parentComponent == null && Desktop.instance == null))
     {
-      JInternalFrame jif = this.createInternalFrame(parentComponent, title);
+      JInternalFrame jif = this.createInternalFrame(
+              parentComponent != null ? parentComponent : Desktop.instance,
+              title);
       jif.setFrameIcon(null);
       jif.addInternalFrameListener(new InternalFrameListener()
       {