From a10a465359de7b8c0baff4925d4b267a28eb0071 Mon Sep 17 00:00:00 2001 From: jprocter Date: Tue, 15 Jun 2010 10:16:56 +0000 Subject: [PATCH] NPE in hashtable constructor --- src/jalview/gui/FeatureRenderer.java | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/src/jalview/gui/FeatureRenderer.java b/src/jalview/gui/FeatureRenderer.java index f784600..585e0a2 100755 --- a/src/jalview/gui/FeatureRenderer.java +++ b/src/jalview/gui/FeatureRenderer.java @@ -112,11 +112,24 @@ public class FeatureRenderer */ public FeatureRendererSettings(FeatureRenderer fr) { - this.renderOrder = new String[fr.renderOrder.length]; - System.arraycopy(fr.renderOrder, 0, renderOrder, 0, - renderOrder.length); - this.featureGroups = new Hashtable(fr.featureGroups); - this.featureColours = new Hashtable(fr.featureColours); + renderOrder = null; + featureGroups = new Hashtable(); + featureColours = new Hashtable(); + featureOrder = new Hashtable(); + if (fr.renderOrder != null) + { + this.renderOrder = new String[fr.renderOrder.length]; + System.arraycopy(fr.renderOrder, 0, renderOrder, 0, + renderOrder.length); + } + if (fr.featureGroups != null) + { + this.featureGroups = new Hashtable(fr.featureGroups); + } + if (fr.featureColours != null) + { + this.featureColours = new Hashtable(fr.featureColours); + } Enumeration en = fr.featureColours.keys(); while (en.hasMoreElements()) { @@ -129,7 +142,10 @@ public class FeatureRenderer } } this.transparency = fr.transparency; - this.featureOrder = new Hashtable(fr.featureOrder); + if (fr.featureOrder != null) + { + this.featureOrder = new Hashtable(fr.featureOrder); + } } } -- 1.7.10.2