From: Jim Procter Date: Mon, 20 Jun 2016 12:47:30 +0000 (+0100) Subject: JAL-2068 avoid ArrayIndexOutOfBounds when consensus accessed before calculation has... X-Git-Tag: Release_2_10_0~161^2~10^2~4 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=d2749ce7a8dba3edbb210e82ec9a7e0c6e28cecf;p=jalview.git JAL-2068 avoid ArrayIndexOutOfBounds when consensus accessed before calculation has been completed --- diff --git a/src/jalview/datamodel/SequenceGroup.java b/src/jalview/datamodel/SequenceGroup.java index 0e8fa17..4cbc2a9 100755 --- a/src/jalview/datamodel/SequenceGroup.java +++ b/src/jalview/datamodel/SequenceGroup.java @@ -1036,7 +1036,8 @@ public class SequenceGroup implements AnnotatedCollectionI /** * - * @return automatically calculated consensus row + * @return automatically calculated consensus row note: the row is a stub if a + * consensus calculation has not yet been performed on the group */ public AlignmentAnnotation getConsensus() { diff --git a/src/jalview/gui/SequenceRenderer.java b/src/jalview/gui/SequenceRenderer.java index aec61b5..7928a89 100755 --- a/src/jalview/gui/SequenceRenderer.java +++ b/src/jalview/gui/SequenceRenderer.java @@ -455,8 +455,10 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer .getCharAt(position) : av.getAlignment().getSeqrep() .getCharAt(position))) : (currentGroup != null && currentGroup.getConsensus() != null - && position >= currentGroup.getStartRes() && position <= currentGroup - .getEndRes()) ? currentGroup.getConsensus().annotations[position].displayCharacter + && position >= currentGroup.getStartRes() + && position <= currentGroup.getEndRes() && currentGroup + .getConsensus().annotations.length > position) ? currentGroup + .getConsensus().annotations[position].displayCharacter .charAt(0) : av.getAlignmentConsensusAnnotation().annotations[position].displayCharacter .charAt(0);