JAL-1691 avoid NPE when original split frame has been closed before the alignment...
authorJim Procter <jprocter@issues.jalview.org>
Thu, 25 Jun 2015 10:13:09 +0000 (11:13 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Thu, 25 Jun 2015 10:13:09 +0000 (11:13 +0100)
src/jalview/ws/jws2/MsaWSThread.java

index d0d0a6e..d2c1b38 100644 (file)
@@ -959,6 +959,7 @@ class MsaWSThread extends AWS2Thread implements WSClientI
     }
     else
     {
+      // TODO 2.9.x feature
       System.out.println("MERGE WITH OLD FRAME");
       // TODO: modify alignment in original frame, replacing old for new
       // alignment using the commands.EditCommand model to ensure the update can
@@ -987,17 +988,22 @@ class MsaWSThread extends AWS2Thread implements WSClientI
       addSortByMenuItems(af, alorders);
     }
 
+    // TODO: refactor retrieve and show as new splitFrame as Desktop method
+
     /*
      * If alignment was requested from one half of a SplitFrame, show in a
      * SplitFrame with the other pane similarly aligned.
      */
     AlignFrame requestedBy = getRequestingAlignFrame();
-    if (requestedBy != null && requestedBy.getSplitViewContainer() != null)
+    if (requestedBy != null && requestedBy.getSplitViewContainer() != null
+               && requestedBy.getSplitViewContainer().getComplement(requestedBy)!=null)
     {
       AlignmentI complement = requestedBy.getSplitViewContainer()
               .getComplement(requestedBy);
       String complementTitle = requestedBy.getSplitViewContainer()
               .getComplementTitle(requestedBy);
+      // becomes null if the alignment window was closed before the alignment
+      // job finished.
       AlignmentI copyComplement = new Alignment(complement);
       copyComplement.alignAs(al);
       if (copyComplement.getHeight() > 0)