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
commit c5721fb7e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

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);