Skip to content
Snippets Groups Projects
Commit 4aa3993d authored by Peter Alexander's avatar Peter Alexander
Browse files

Fix NPE in debug / output code

parent 9736907d
No related branches found
No related tags found
No related merge requests found
......@@ -69,7 +69,8 @@ public class GamsRasterOptimiser {
for (LandCoverType l : LandCoverType.values()) {
double total = 0;
for (LandUseItem a : areaRaster.values()) {
total += a.getLandCoverArea(l);
if (a != null)
total += a.getLandCoverArea(l);
}
LogWriter.printlnError("Total Area " + comment + ": " + l.getName() + ": " + total);
......@@ -77,10 +78,12 @@ public class GamsRasterOptimiser {
double protectedAreaIncMinNatural=0, suitableArea=0, protectedArea=0, unprotectedArea=0;
for (LandUseItem a : areaRaster.values()) {
protectedArea += a.getProtectedArea();
unprotectedArea += a.getUnprotectedArea();
protectedAreaIncMinNatural += a.getProtectedAreaIncMinNatural();
suitableArea += a.getSuitableLand();
if (a != null) {
protectedArea += a.getProtectedArea();
unprotectedArea += a.getUnprotectedArea();
protectedAreaIncMinNatural += a.getProtectedAreaIncMinNatural();
suitableArea += a.getSuitableLand();
}
}
LogWriter.println("Total protectedArea " + comment + ": " + protectedArea);
LogWriter.println("Total unprotectedArea " + comment + ": " + unprotectedArea);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment