more !isEmpty checks to validate ItemStacks

This commit is contained in:
Xander Victory committed 2017-06-14 14:16:37 +08:00
1 parent 785cb2c683
commit f3cd020a31
4 files changed
+5 -5

No files matched your search

@@ -220,7 +220,7 @@ abstract class BasicEnergyTile implements ILocatable, IEnergyTile {
* @return true if energy was transferred
*/
public boolean charge(ItemStack stack) {
if (stack == null || !Info.isIc2Available() || getWorldObj().isRemote) return false;
if (stack == null || stack.isEmpty() || !Info.isIc2Available() || getWorldObj().isRemote) return false;
double amount = ElectricItem.manager.charge(stack, energyStored, Math.max(getSinkTier(), getSourceTier()), false, false);
@@ -237,7 +237,7 @@ abstract class BasicEnergyTile implements ILocatable, IEnergyTile {
* @return true if energy was transferred
*/
public boolean discharge(ItemStack stack, double limit) {
if (stack == null || !Info.isIc2Available() || getWorldObj().isRemote) return false;
if (stack == null || stack.isEmpty() || !Info.isIc2Available() || getWorldObj().isRemote) return false;
double amount = capacity - energyStored;
if (amount <= 0) return false;