JAL-845 avoid OOBException when method is called with only one view
[jalview.git] / src / jalview / gui / AlignFrame.java
index 3ef56bf..6a42a65 100644 (file)
@@ -5930,7 +5930,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
       throw new Error(MessageManager.getString("error.implementation_error_cannot_show_view_alignment_frame"));
     }
     if (tabbedPane != null
-            & alignPanels.indexOf(alignmentPanel) != tabbedPane
+            && tabbedPane.getTabCount() > 0
+            && alignPanels.indexOf(alignmentPanel) != tabbedPane
                     .getSelectedIndex())
     {
       tabbedPane.setSelectedIndex(alignPanels.indexOf(alignmentPanel));