From d5e511ac84966aa57707ee02e9a4b6d5976acfb2 Mon Sep 17 00:00:00 2001 From: Francesco Macagno Date: Sat, 29 Aug 2015 13:13:52 -0700 Subject: [PATCH] Fixed NPE --- .../java/cr0s/warpdrive/config/filler/FillerSet.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/cr0s/warpdrive/config/filler/FillerSet.java b/src/main/java/cr0s/warpdrive/config/filler/FillerSet.java index 1725b2f6..4ba2dafe 100644 --- a/src/main/java/cr0s/warpdrive/config/filler/FillerSet.java +++ b/src/main/java/cr0s/warpdrive/config/filler/FillerSet.java @@ -2,8 +2,6 @@ package cr0s.warpdrive.config.filler; import java.util.Random; -import net.minecraft.block.Block; - import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; @@ -12,6 +10,8 @@ import cr0s.warpdrive.WarpDrive; import cr0s.warpdrive.config.InvalidXmlException; import cr0s.warpdrive.config.MetaBlock; import cr0s.warpdrive.config.XmlRepresentable; +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; /** * Represents a set of fillers. Before using after construction, finishContruction() must be called. @@ -136,6 +136,14 @@ public class FillerSet implements XmlRepresentable, Comparable { public void finishContruction() { WarpDrive.logger.info("Finishing construction of FillerSet " + name); weightedFillerBlocks = factory.constructWeightedMetaBlockList(); + + //For some reason some entries are null, so replace them with air + for (int i = 0; i < weightedFillerBlocks.length; i++) { + if (weightedFillerBlocks[i] == null) + weightedFillerBlocks[i] = MetaBlock.getMetaBlock(Blocks.air, 0); + + } + factory = null; }