Skip to content

Commit 750dde5

Browse files
accepting null from the argument list
1 parent 38a6bc3 commit 750dde5

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

  • commands/src/main/java/com/wizardlybump17/wlib/command

commands/src/main/java/com/wizardlybump17/wlib/command/Command.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ public Command(@NotNull LiteralCommandNode root) {
145145
String inputString = input.get(i);
146146
boolean isLastInput = i == input.size() - 1;
147147

148-
if (inputString.isEmpty()) {
148+
if (inputString != null && inputString.isEmpty()) {
149149
for (CommandNode<?> child : children) {
150150
String permission = child.getPermission();
151151
if (permission == null || sender.hasPermission(permission))
@@ -162,6 +162,12 @@ public Command(@NotNull LiteralCommandNode root) {
162162

163163
if (!isLastInput) {
164164
try {
165+
if (inputString == null) {
166+
if (!child.isValidInput(null))
167+
throw new InvalidInputException("Null inputs not accepted by " + child);
168+
continue;
169+
}
170+
165171
child.parseOrInvalid(inputString);
166172
} catch (InputParsingException | InvalidInputException e) {
167173
lastError = e;

0 commit comments

Comments
 (0)