From 817fdeae3fbdbbbc8a1617437913c343198027db Mon Sep 17 00:00:00 2001 From: Acrobot Date: Wed, 28 Nov 2012 21:30:53 +0100 Subject: [PATCH] Added prevention against NPEs in MaterialUtil --- com/Acrobot/Breeze/Utils/MaterialUtil.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/com/Acrobot/Breeze/Utils/MaterialUtil.java b/com/Acrobot/Breeze/Utils/MaterialUtil.java index 93c891f..46d9da3 100644 --- a/com/Acrobot/Breeze/Utils/MaterialUtil.java +++ b/com/Acrobot/Breeze/Utils/MaterialUtil.java @@ -383,7 +383,9 @@ public class MaterialUtil { if (data instanceof TexturedMaterial) { return ((TexturedMaterial) data).getMaterial().name(); } else if (data instanceof Colorable) { - return ((Colorable) data).getColor().name(); + DyeColor color = ((Colorable) data).getColor(); + + return (color != null ? color.name() : null); } else if (data instanceof Tree) { //TreeSpecies specie = TreeSpecies.getByData((byte) (data.getData() & 3)); //This works, but not as intended TreeSpecies specie = ((Tree) data).getSpecies();