core: Don't parse empty input strings in FlagArgument parser
This commit is contained in:
parent
3b2f2edb60
commit
be4cd4101f
1 changed files with 9 additions and 0 deletions
|
|
@ -428,6 +428,15 @@ public final class FlagArgument<C> extends CommandArgument<C, Object> {
|
|||
this.currentFlagBeingParsed = Optional.of(currentFlag);
|
||||
this.currentFlagNameBeingParsed = Optional.of(currentFlagName);
|
||||
|
||||
// Don't attempt to parse empty strings
|
||||
if (inputQueue.peek().isEmpty()) {
|
||||
return ArgumentParseResult.failure(new FlagParseException(
|
||||
currentFlag.getName(),
|
||||
FailureReason.MISSING_ARGUMENT,
|
||||
commandContext
|
||||
));
|
||||
}
|
||||
|
||||
final ArgumentParseResult<?> result =
|
||||
((CommandArgument) currentFlag.getCommandArgument())
|
||||
.getParser()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue