From eaabc971e04c8dd9553ced31b5bc19de43e94187 Mon Sep 17 00:00:00 2001 From: chochem <40274384+chochem@users.noreply.github.com> Date: Fri, 2 Feb 2024 09:46:42 +0000 Subject: fix divide by zero exception (#2486) fix 0 check --- src/main/java/gregtech/api/util/GT_ExoticEnergyInputHelper.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/main/java/gregtech/api/util') diff --git a/src/main/java/gregtech/api/util/GT_ExoticEnergyInputHelper.java b/src/main/java/gregtech/api/util/GT_ExoticEnergyInputHelper.java index f167651825..d59796b251 100644 --- a/src/main/java/gregtech/api/util/GT_ExoticEnergyInputHelper.java +++ b/src/main/java/gregtech/api/util/GT_ExoticEnergyInputHelper.java @@ -81,13 +81,13 @@ public class GT_ExoticEnergyInputHelper { public static long getAverageInputVoltageMulti(Collection hatches) { long rVoltage = 0; - if (hatches.isEmpty()) { - return rVoltage; - } for (GT_MetaTileEntity_Hatch tHatch : filterValidMTEs(hatches)) { rVoltage += tHatch.getBaseMetaTileEntity() .getInputVoltage(); } + if (hatches.isEmpty()) { + return 0; + } return rVoltage / hatches.size(); } -- cgit