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

Some additional null checking

parent c34291a1
No related branches found
No related tags found
No related merge requests found
......@@ -376,7 +376,12 @@ public class GamsRasterOptimiser {
IrrigationItem irrigItem = irrigRaster.get(key);
int clusterId = mapping.get(key).getInt();
IntegerRasterItem clusterItem = mapping.get(key);
if (clusterItem == null) {
LogWriter.printlnError("Warning: GamsRasterOptimiser no cluster for key" + key);
continue;
}
int clusterId = clusterItem.getInt();
YieldResponsesItem aggYResp = aggregatedYields.lazyGet(clusterId);
LandUseItem aggLandUse = aggregatedAreas.lazyGet(clusterId);
......
......@@ -41,8 +41,14 @@ public abstract class AbstractDemandManager implements Serializable {
for (SingleCountry c : compositeCountryManager.getAllForCompositeCountry(cc)) {
foodDemandMap = getFoodDemand(c, year, prices, outputGamsDemand);
try {
foodDemandMap = getFoodDemand(c, year, prices, outputGamsDemand);
} catch (Exception e) {
LogWriter.printlnError("Error: AbstractDemandManager not including " + c + " due to exception");
LogWriter.print(e);
continue;
}
for (CommodityType commodity : CommodityType.getAllFoodItems()) {
Double food = foodDemandMap.get(commodity);
......
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