From 28a92d22dcc32ba75f641e98540b1721348f0eb0 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Thu, 16 Jan 2014 09:19:26 -0800 Subject: [PATCH] Prevent CTRL-D from causing NPE in shell Update the integrated shell to deal with a null line which can be triggered with CTRL-D. Fixes gh-229 --- .../org/springframework/boot/cli/command/shell/Shell.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/Shell.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/Shell.java index cfb6e23462..e0f67fe702 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/Shell.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/Shell.java @@ -175,8 +175,8 @@ public class Shell { } private void runInputLoop() throws Exception { - while (true) { - String line = this.consoleReader.readLine(getPrompt()); + String line; + while ((line = this.consoleReader.readLine(getPrompt())) != null) { while (line.endsWith("\\")) { line = line.substring(0, line.length() - 1); line += this.consoleReader.readLine("> ");