Merge pull request #3878 from wagyourtail/1.12/fix-wp-c

make wp c not throw npe on invalid tag name
This commit is contained in:
leijurv
2023-03-14 18:40:41 -07:00
committed by GitHub

View File

@@ -149,7 +149,11 @@ public class WaypointsCommand extends Command {
logDirect(component);
} else if (action == Action.CLEAR) {
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);
for (IWaypoint waypoint : waypoints) {
ForWaypoints.waypoints(this.baritone).removeWaypoint(waypoint);