From 4ca2af929026622d9a9300b8b9553cc532c46614 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Ckpepper=E2=80=9D?= <kp11@sanger.ac.uk> Date: Fri, 26 Jan 2018 11:39:58 +0000 Subject: [PATCH] Fixed negative array index exception in BamView (does not affect Artemis) --- .../artemis/components/alignment/BamView.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/uk/ac/sanger/artemis/components/alignment/BamView.java b/uk/ac/sanger/artemis/components/alignment/BamView.java index 8eb9d9622..132c1f4f4 100644 --- a/uk/ac/sanger/artemis/components/alignment/BamView.java +++ b/uk/ac/sanger/artemis/components/alignment/BamView.java @@ -3272,9 +3272,26 @@ public class BamView extends JPanel { laststart = -1; if(feature_display != null) + { setZoomLevel(feature_display.getMaxVisibleBases()); + } else + { + /* + * Reset the scroll bar to the left hand side when we change + * the combo selection (for bamview). If this is not done + * then we can go to the end of one [long] contig, select a new one that's + * shorter and we will end up off the end of it in no-man's land + * - this eventually leads to an array negative index exception in + * iterateOverBam + */ + startBase = -1; + endBase = -1; + scrollBar.setValues(1, BamView.this.nbasesInView, 1, + getMaxBasesInPanel(getSequenceLength())); setZoomLevel(BamView.this.nbasesInView); + repaint(); + } } }; topPanel.add(combo); -- GitLab