Skip to content

Commit

Permalink
fix CompletionAdaptor index out of bounds when the token is empty (a…
Browse files Browse the repository at this point in the history
  • Loading branch information
xuzhiyiYoh authored and hengyunabc committed Mar 30, 2019
1 parent 6af9393 commit b265f5b
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public List<CliToken> lineTokens() {

@Override
public void complete(List<String> candidates) {
String lastToken = tokens.get(tokens.size() - 1).value();
String lastToken = tokens.isEmpty() ? null : tokens.get(tokens.size() - 1).value();
if(StringUtils.isBlank(lastToken)) {
lastToken = "";
}
Expand Down

0 comments on commit b265f5b

Please sign in to comment.