From cd282e42454d0eb233e0dcabc0de10c1fa1815ea Mon Sep 17 00:00:00 2001 From: miozune Date: Tue, 27 Sep 2022 00:15:29 +0900 Subject: Fix NPE with Crop Harvester (#378) * Fix NPE with Crop Harvester * address review --- .../tileentities/machines/basic/GT_MetaTileEntity_CropHarvestor.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities') diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CropHarvestor.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CropHarvestor.java index 2847a15539..bea3645a03 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CropHarvestor.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CropHarvestor.java @@ -270,9 +270,9 @@ public class GT_MetaTileEntity_CropHarvestor extends GT_MetaTileEntity_BasicTank ItemStack[] aHarvest = tCrop.harvest_automated(true); if (aHarvest != null && aHarvest.length > 0) { for (ItemStack aStack : aHarvest) { - if (aStack.stackSize > 0) { + if (aStack != null && aStack.stackSize > 0) { if (this.mTier * 5 > MathUtils.randInt(1, 100)) { - aStack.stackSize += Math.floor(tCrop.getGain() / 10); + aStack.stackSize += tCrop.getGain() / 10; Logger.INFO("Bonus output given for " + aCrop.displayName()); } Logger.INFO("Harvested " + aCrop.displayName()); -- cgit