mirror of https://github.com/cabaletta/baritone
make wp c not throw npe on invalid tag name
This commit is contained in:
parent
790a4f6769
commit
6698505dd8
|
@ -149,7 +149,11 @@ public class WaypointsCommand extends Command {
|
||||||
logDirect(component);
|
logDirect(component);
|
||||||
} else if (action == Action.CLEAR) {
|
} else if (action == Action.CLEAR) {
|
||||||
args.requireMax(1);
|
args.requireMax(1);
|
||||||
IWaypoint.Tag tag = IWaypoint.Tag.getByName(args.getString());
|
String name = args.getString();
|
||||||
|
IWaypoint.Tag tag = IWaypoint.Tag.getByName(name);
|
||||||
|
if (tag == null) {
|
||||||
|
throw new CommandInvalidStateException("Invalid tag, \"" + name + "\"");
|
||||||
|
}
|
||||||
IWaypoint[] waypoints = ForWaypoints.getWaypointsByTag(this.baritone, tag);
|
IWaypoint[] waypoints = ForWaypoints.getWaypointsByTag(this.baritone, tag);
|
||||||
for (IWaypoint waypoint : waypoints) {
|
for (IWaypoint waypoint : waypoints) {
|
||||||
ForWaypoints.waypoints(this.baritone).removeWaypoint(waypoint);
|
ForWaypoints.waypoints(this.baritone).removeWaypoint(waypoint);
|
||||||
|
|
Loading…
Reference in New Issue