fix CompletionAdaptor index out of bounds when the token is empty (#610)

This commit is contained in:
xuzhiyiYoh
2019-03-30 13:28:18 +08:00
committed by hengyunabc
parent 6af9393a02
commit b265f5b141
@@ -43,7 +43,7 @@ class CompletionAdaptor implements Completion {
@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 = "";
}