Add null check when determining potential tanks to import (#116)

It seems that implementers of IFluidHandler sometimes return null
in `getTankInfo()`, so this adds a check for that before doing the
bus work.
This commit is contained in:
firenoo authored and GitHub committed 2023-04-26 21:14:40 +02:00
1 parent c174db3f15
commit 508f6e5d64
1 file changed
+6 -2
@@ -68,11 +68,15 @@ public class PartFluidImportBus extends FCSharedFluidBus {
if (te instanceof IFluidHandler) {
try {
final IFluidHandler fh = (IFluidHandler) te;
final IMEMonitor<IAEFluidStack> inv = this.getProxy().getStorage().getFluidInventory();
FluidTankInfo[] tanksInfo = fh.getTankInfo(this.getSide().getOpposite());
if (tanksInfo == null) {
return TickRateModulation.SLOWER;
}
final IMEMonitor<IAEFluidStack> inv = this.getProxy().getStorage().getFluidInventory();
int maxDrain = this.calculateAmountToSend();
boolean drained = false;
FluidTankInfo[] tanksInfo = fh.getTankInfo(this.getSide().getOpposite());
for (FluidTankInfo tankInfo : tanksInfo) {
if (tankInfo.fluid == null) {
continue;