fixed stacktrace potential for pairwise alignment action.
[jalview.git] / src / jalview / gui / AlignFrame.java
index 6447005..83ee1c3 100755 (executable)
@@ -106,9 +106,7 @@ public class AlignFrame extends GAlignFrame
   protected void outputText_actionPerformed(ActionEvent e)
   {
      CutAndPasteTransfer cap = new CutAndPasteTransfer();
-     JInternalFrame frame = new JInternalFrame();
-     frame.setContentPane(cap);
-     Desktop.addInternalFrame(frame, "Alignment output - "+e.getActionCommand(), 600, 500);
+     Desktop.addInternalFrame(cap, "Alignment output - "+e.getActionCommand(), 600, 500);
      cap.setText( FormatAdapter.formatSequences(e.getActionCommand(), viewport.getAlignment().getSequences()));
   }
 
@@ -997,7 +995,7 @@ public class AlignFrame extends GAlignFrame
 
   public void removeRedundancyMenuItem_actionPerformed(ActionEvent e)
   {
-    RedundancyPanel sp = new RedundancyPanel(alignPanel, this);
+    RedundancyPanel sp = new RedundancyPanel(alignPanel,this);
     JInternalFrame frame = new JInternalFrame();
     frame.setContentPane(sp);
     Desktop.addInternalFrame(frame, "Redundancy threshold selection", 400, 100, false);
@@ -1006,7 +1004,8 @@ public class AlignFrame extends GAlignFrame
 
   public void pairwiseAlignmentMenuItem_actionPerformed(ActionEvent e)
   {
-    if(viewport.getSelectionGroup().getSize()<2)
+    if((viewport.getSelectionGroup()==null) ||
+       viewport.getSelectionGroup().getSize()<2)
       JOptionPane.showInternalMessageDialog(this, "You must select at least 2 sequences.", "Invalid Selection", JOptionPane.WARNING_MESSAGE);
     else
     {