mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-28 07:36:01 +00:00
Fix potential null pointer when using the result of TransporterStack#getSide
This commit is contained in:
1 file changed
+8
-4
@@ -214,19 +214,23 @@ public class TransporterStack {
|
||||
}
|
||||
|
||||
public EnumFacing getSide(ILogisticalTransporter transporter) {
|
||||
EnumFacing side = null;
|
||||
if (progress < 50) {
|
||||
Coord4D prev = getPrev(transporter);
|
||||
if (prev != null) {
|
||||
return transporter.coord().sideDifference(prev);
|
||||
side = transporter.coord().sideDifference(prev);
|
||||
}
|
||||
} else {
|
||||
Coord4D next = getNext(transporter);
|
||||
if (next != null) {
|
||||
return next.sideDifference(transporter.coord());
|
||||
side = next.sideDifference(transporter.coord());
|
||||
}
|
||||
}
|
||||
|
||||
return EnumFacing.DOWN;
|
||||
//sideDifference can return null
|
||||
//TODO: Look into implications further about what side should be returned.
|
||||
// This is mainly to stop a crash I randomly encountered but was unable to reproduce.
|
||||
// (I believe the difference returns null when it is the "same" transporter somehow or something)
|
||||
return side == null ? EnumFacing.DOWN : side;
|
||||
}
|
||||
|
||||
public boolean canInsertToTransporter(TileEntity tileEntity, EnumFacing from) {
|
||||
|
||||
Reference in new issue
Block a user