From 2f0ba42fa0f39ba07248679361bc84de4bd07ea0 Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Fri, 12 Oct 2018 22:12:15 -0400 Subject: [PATCH] Also make sure tab list completion doesn't crash the proxy --- .../proxy/console/VelocityConsole.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/console/VelocityConsole.java b/proxy/src/main/java/com/velocitypowered/proxy/console/VelocityConsole.java index 5fd60d35b..fa1ac0bee 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/console/VelocityConsole.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/console/VelocityConsole.java @@ -51,12 +51,16 @@ public final class VelocityConsole extends SimpleTerminalConsole implements Comm return super.buildReader(builder .appName("Velocity") .completer((reader, parsedLine, list) -> { - Optional> o = this.server.getCommandManager().offerSuggestions(this, parsedLine.line()); - o.ifPresent(offers -> { - for (String offer : offers) { - list.add(new Candidate(offer)); - } - }); + try { + Optional> 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); + } }) ); }