From d56106a495330b21cae078d7442f3990b1bf66f2 Mon Sep 17 00:00:00 2001
From: Schankula Christopher <schankuc@mcmaster.ca>
Date: Tue, 27 Mar 2018 18:10:07 -0400
Subject: [PATCH] hopefully finally fixed null pointer error

---
 src/data/BioTree.java | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/data/BioTree.java b/src/data/BioTree.java
index 4e6ae18..362adfc 100644
--- a/src/data/BioTree.java
+++ b/src/data/BioTree.java
@@ -2,6 +2,7 @@ package data;
 
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.ObjectInputStream;
@@ -172,6 +173,7 @@ public class BioTree implements Serializable {
 		Integer taxonId = getTaxonRecord(scientificName);
 		System.out.println(scientificName + ": " + taxonId);
 		if (taxonId == null) return null;
+		if (taxonId == -1)   return null;
 		if (processTaxonId(taxonId)) return null;
 		return taxonId;
 	}
@@ -255,9 +257,10 @@ public class BioTree implements Serializable {
 		else System.out.println(scientificName + " not in local db");
 		//look up in local incorrect names database, return if it exists
 		taxonId = incorrectNames.get(scientificName);
-		if (taxonId != null)
-			return idNodes.get(taxonId).getTaxonId();
-		else {		//otherwise use Worms to look it up
+		if (taxonId != null) {
+			tx = idNodes.get(taxonId);
+			if (tx != null) return tx.getTaxonId();
+		} else {		//otherwise use Worms to look it up
 			System.out.println(scientificName + " not in incor db");
 			taxonId = WormsAPI.nameToRecordID(scientificName);
 			if (taxonId == null) //if nothing is found, mark this species as not existing.
-- 
GitLab