From 6698505dd83b239f67d5ca459196d011c852ed49 Mon Sep 17 00:00:00 2001 From: Wagyourtail Date: Mon, 13 Mar 2023 15:31:18 -0700 Subject: [PATCH] make wp c not throw npe on invalid tag name --- .../java/baritone/command/defaults/WaypointsCommand.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/baritone/command/defaults/WaypointsCommand.java b/src/main/java/baritone/command/defaults/WaypointsCommand.java index cf420e90a..3016745e1 100644 --- a/src/main/java/baritone/command/defaults/WaypointsCommand.java +++ b/src/main/java/baritone/command/defaults/WaypointsCommand.java @@ -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);