mta: Null checks
This commit is contained in:
@@ -249,7 +249,10 @@ public class AlchemyRoom extends MTARoom
|
|||||||
Cupboard clicked = getClicked();
|
Cupboard clicked = getClicked();
|
||||||
if (clicked.alchemyItem != alchemyItem)
|
if (clicked.alchemyItem != alchemyItem)
|
||||||
{
|
{
|
||||||
fill(clicked, alchemyItem);
|
if (alchemyItem != null)
|
||||||
|
{
|
||||||
|
fill(clicked, alchemyItem);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (message.equals(EMPTY))
|
else if (message.equals(EMPTY))
|
||||||
|
|||||||
@@ -286,7 +286,11 @@ public class TelekineticRoom extends MTARoom
|
|||||||
|
|
||||||
Direction next = moves.pop();
|
Direction next = moves.pop();
|
||||||
WorldArea areaNext = getIndicatorLine(next);
|
WorldArea areaNext = getIndicatorLine(next);
|
||||||
WorldPoint nearestNext = nearest(areaNext, current);
|
WorldPoint nearestNext = null;
|
||||||
|
if (areaNext != null)
|
||||||
|
{
|
||||||
|
nearestNext = nearest(areaNext, current);
|
||||||
|
}
|
||||||
|
|
||||||
if (moves.isEmpty())
|
if (moves.isEmpty())
|
||||||
{
|
{
|
||||||
@@ -298,9 +302,20 @@ public class TelekineticRoom extends MTARoom
|
|||||||
Direction after = moves.peek();
|
Direction after = moves.peek();
|
||||||
moves.push(next);
|
moves.push(next);
|
||||||
WorldArea areaAfter = getIndicatorLine(after);
|
WorldArea areaAfter = getIndicatorLine(after);
|
||||||
WorldPoint nearestAfter = nearest(areaAfter, nearestNext);
|
WorldPoint nearestAfter = null;
|
||||||
|
if (areaAfter != null)
|
||||||
|
{
|
||||||
|
nearestAfter = nearest(areaAfter, nearestNext);
|
||||||
|
}
|
||||||
|
|
||||||
return nearest(areaNext, nearestAfter);
|
if (areaNext != null)
|
||||||
|
{
|
||||||
|
return nearest(areaNext, nearestAfter);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return nearestAfter;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int manhattan(WorldPoint point1, WorldPoint point2)
|
private static int manhattan(WorldPoint point1, WorldPoint point2)
|
||||||
|
|||||||
Reference in New Issue
Block a user