mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-23 04:24:16 -04:00
fix gtnh-found null fluid tank info crash
This commit is contained in:
parent
33eb8cb7fd
commit
e84596e522
@ -47,6 +47,7 @@
|
|||||||
* Fixed: Missing null check for Blood Magic integration.
|
* Fixed: Missing null check for Blood Magic integration.
|
||||||
* Fixed: [#3336] Missing null check for GregTech data stick NBTs.
|
* Fixed: [#3336] Missing null check for GregTech data stick NBTs.
|
||||||
* Fixed: [#3249] NullPointerException when remote terminal is missing.
|
* Fixed: [#3249] NullPointerException when remote terminal is missing.
|
||||||
|
* Fixed: Potential edge case crash with the Tank Controller Upgrade.
|
||||||
* Fixed: [#3401] 'rawSetForeground', 'rawSetBackground' not working correctly.
|
* Fixed: [#3401] 'rawSetForeground', 'rawSetBackground' not working correctly.
|
||||||
* Fixed: [#3265] Relay 'setStrength' unlimited upper bound. (JamesOrdner)
|
* Fixed: [#3265] Relay 'setStrength' unlimited upper bound. (JamesOrdner)
|
||||||
* (1.7.10) Fixed: [#3540] Server-side crash with Motion Sensor
|
* (1.7.10) Fixed: [#3540] Server-side crash with Motion Sensor
|
||||||
|
@ -52,7 +52,10 @@ trait WorldTankAnalytics extends WorldAware with SideRestricted {
|
|||||||
def getTankCount(context: Context, args: Arguments): Array[AnyRef] = {
|
def getTankCount(context: Context, args: Arguments): Array[AnyRef] = {
|
||||||
val facing = checkSideForAction(args, 0)
|
val facing = checkSideForAction(args, 0)
|
||||||
FluidUtils.fluidHandlerAt(position.offset(facing)) match {
|
FluidUtils.fluidHandlerAt(position.offset(facing)) match {
|
||||||
case Some(handler) => result(handler.getTankInfo(facing.getOpposite).length)
|
case Some(handler) => handler.getTankInfo(facing.getOpposite) match {
|
||||||
|
case info: Array[FluidTankInfo] => result(info.length)
|
||||||
|
case _ => result(Unit, "no tank")
|
||||||
|
}
|
||||||
case _ => result(Unit, "no tank")
|
case _ => result(Unit, "no tank")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,10 +46,11 @@ object ExtendedArguments {
|
|||||||
|
|
||||||
def checkTankInfo(handler: IFluidHandler, side: ForgeDirection, n: Int) = {
|
def checkTankInfo(handler: IFluidHandler, side: ForgeDirection, n: Int) = {
|
||||||
val tank = args.checkInteger(n) - 1
|
val tank = args.checkInteger(n) - 1
|
||||||
if (tank < 0 || tank >= handler.getTankInfo(side).length) {
|
val tankInfo = handler.getTankInfo(side)
|
||||||
|
if (tankInfo == null || tank < 0 || tank >= tankInfo.length) {
|
||||||
throw new IllegalArgumentException("invalid tank index")
|
throw new IllegalArgumentException("invalid tank index")
|
||||||
}
|
}
|
||||||
handler.getTankInfo(side)(tank)
|
tankInfo(tank)
|
||||||
}
|
}
|
||||||
|
|
||||||
def optTankInfo(handler: IFluidHandler, side: ForgeDirection, n: Int, default: FluidTankInfo) = {
|
def optTankInfo(handler: IFluidHandler, side: ForgeDirection, n: Int, default: FluidTankInfo) = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user