Skip to content

Commit

Permalink
Add some safety checks for null refs in movement
Browse files Browse the repository at this point in the history
  • Loading branch information
cam72cam committed Jan 6, 2019
1 parent 203fe7e commit b6701ed
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -445,8 +445,8 @@ public Vec3d getNextPosition(Vec3d currentPosition, Vec3d motion) {
TileRailBase target = this;
while(target != null) {
TileRail parent = target.getParentTile();
if (parent != null) {
boolean isSameTrack = parent.getParentTile().getPos().equals(tile.getParentTile().getPos());;
if (parent != null && parent.getParentTile() != null && tile.getParentTile() != null) {
boolean isSameTrack = parent.getParentTile().getPos().equals(tile.getParentTile().getPos());
if (!isSameTrack) {
Vec3d potential = parent.getNextPosition(currentPosition, motion);
if (potential.distanceTo(currentPosition.add(motion)) < nextPos.distanceTo(currentPosition.add(motion))) {
Expand Down

0 comments on commit b6701ed

Please sign in to comment.