From fe89a9835edc5b10a052cd58669b1826f5b57abd Mon Sep 17 00:00:00 2001 From: Jordan Byrne Date: Mon, 26 Feb 2018 17:14:29 +1000 Subject: $ Findbugs Fixes. --- .../gtPlusPlus/core/material/MaterialGenerator.java | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src/Java/gtPlusPlus/core/material') diff --git a/src/Java/gtPlusPlus/core/material/MaterialGenerator.java b/src/Java/gtPlusPlus/core/material/MaterialGenerator.java index fb9cf932cb..14dda50614 100644 --- a/src/Java/gtPlusPlus/core/material/MaterialGenerator.java +++ b/src/Java/gtPlusPlus/core/material/MaterialGenerator.java @@ -233,11 +233,23 @@ public class MaterialGenerator { @SuppressWarnings("unused") public static void generateOreMaterial(final Material matInfo){ try { + + if (matInfo == null){ + Logger.DEBUG_MATERIALS("Invalid Material while constructing null material."); + return; + } + final String unlocalizedName = matInfo.getUnlocalizedName(); final String materialName = matInfo.getLocalizedName(); final short[] C = matInfo.getRGBA(); final Integer Colour = Utils.rgbtoHexValue(C[0], C[1], C[2]); + + if (Colour == null){ + Logger.DEBUG_MATERIALS("Invalid Material while constructing "+materialName+"."); + return; + } + int sRadiation = 0; if (matInfo.vRadiationLevel > 0){ sRadiation = matInfo.vRadiationLevel; @@ -246,9 +258,7 @@ public class MaterialGenerator { Item temp; Block tempBlock; - if (matInfo == null || Colour == null){ - Logger.DEBUG_MATERIALS("Invalid Material while constructing "+materialName+"."); - } + tempBlock = new BlockBaseOre(matInfo, BlockTypes.ORE, Colour.intValue()); @@ -264,7 +274,7 @@ public class MaterialGenerator { RecipeGen_Ore.generateRecipes(matInfo); } catch (final Throwable t){ - Logger.MATERIALS("[Error] "+matInfo.getLocalizedName()+" failed to generate."); + Logger.MATERIALS("[Error] "+(matInfo != null ? matInfo.getLocalizedName() : "Null Material")+" failed to generate."); t.printStackTrace(); } } -- cgit