Also make sure tab list completion doesn't crash the proxy

This commit is contained in:
Andrew Steinborn
2018-10-12 22:12:15 -04:00
parent 1f329b09f3
commit 2f0ba42fa0

View File

@@ -51,12 +51,16 @@ public final class VelocityConsole extends SimpleTerminalConsole implements Comm
return super.buildReader(builder
.appName("Velocity")
.completer((reader, parsedLine, list) -> {
try {
Optional<List<String>> o = this.server.getCommandManager().offerSuggestions(this, parsedLine.line());
o.ifPresent(offers -> {
for (String offer : offers) {
list.add(new Candidate(offer));
}
});
} catch (Exception e) {
logger.error("An error occurred while trying to perform tab completion.", e);
}
})
);
}