From 7c7a5a297e063d3892dd7e629bc317cdde837b81 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Sat, 19 Apr 2014 13:56:18 +0100 Subject: [PATCH] JAL-741 (poss related JAL-971) - fix NPE raised when attempting to sort alignment by feature when lots of groups displayed --- src/jalview/gui/FeatureSettings.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/jalview/gui/FeatureSettings.java b/src/jalview/gui/FeatureSettings.java index d7f05dc..9e0925b 100644 --- a/src/jalview/gui/FeatureSettings.java +++ b/src/jalview/gui/FeatureSettings.java @@ -1158,13 +1158,13 @@ public class FeatureSettings extends JPanel private String[] getDisplayedFeatureGroups() { String[] gps = null; + ArrayList _gps = new ArrayList(); if (fr != null) { if (fr.featureGroups != null) { Iterator en = fr.featureGroups.keySet().iterator(); - gps = new String[fr.featureColours.size()]; int g = 0; boolean valid = false; while (en.hasNext()) @@ -1174,16 +1174,15 @@ public class FeatureSettings extends JPanel if (on != null && on.booleanValue()) { valid = true; - gps[g++] = gp; + _gps.add(gp); } } - while (g < gps.length) - { - gps[g++] = null; - } if (!valid) { return null; + } else { + gps = new String[_gps.size()]; + _gps.toArray(gps); } } } -- 1.7.10.2