From ba60f9d95ee87851417b04b9c62c16dd5fc3088f Mon Sep 17 00:00:00 2001 From: cmzmasek Date: Thu, 14 May 2015 10:18:15 -0700 Subject: [PATCH] Return null instead of throwing a NPE (issue: NPE in NodeData.getSequence()) Change-Id: I19d7921cee63fcd1efa350787c2f2f54500ac291 Signed-off-by: cmzmasek --- .../java/src/org/forester/phylogeny/data/NodeData.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/forester/java/src/org/forester/phylogeny/data/NodeData.java b/forester/java/src/org/forester/phylogeny/data/NodeData.java index 08b3e2c..28b6889 100644 --- a/forester/java/src/org/forester/phylogeny/data/NodeData.java +++ b/forester/java/src/org/forester/phylogeny/data/NodeData.java @@ -178,6 +178,9 @@ public class NodeData implements PhylogenyData { } public Distribution getDistribution( final int index ) { + if ( _distributions == null ) { + return null; + } return _distributions.get( index ); } @@ -204,6 +207,9 @@ public class NodeData implements PhylogenyData { } public Reference getReference( final int index ) { + if ( _references == null ) { + return null; + } return _references.get( index ); } @@ -221,6 +227,9 @@ public class NodeData implements PhylogenyData { } public Sequence getSequence( final int index ) { + if ( _sequences == null ) { + return null; + } return _sequences.get( index ); } @@ -243,6 +252,9 @@ public class NodeData implements PhylogenyData { } public Taxonomy getTaxonomy( final int index ) { + if ( _taxonomies == null ) { + return null; + } return _taxonomies.get( index ); } -- 1.7.10.2