From 5daccdf105e8bc26a351c47a31222b245af5a90e Mon Sep 17 00:00:00 2001 From: Fred Bricon Date: Wed, 18 Oct 2023 15:10:43 +0200 Subject: [PATCH] fix : prevent NPE when calling ConsoleContentPanel.showMessage Signed-off-by: Fred Bricon --- .../intellij/lsp4ij/console/LSPConsoleToolWindowPanel.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/com/redhat/devtools/intellij/lsp4ij/console/LSPConsoleToolWindowPanel.java b/src/main/java/com/redhat/devtools/intellij/lsp4ij/console/LSPConsoleToolWindowPanel.java index ab6f097fc..ee0ed51f3 100644 --- a/src/main/java/com/redhat/devtools/intellij/lsp4ij/console/LSPConsoleToolWindowPanel.java +++ b/src/main/java/com/redhat/devtools/intellij/lsp4ij/console/LSPConsoleToolWindowPanel.java @@ -246,10 +246,16 @@ private void showDetail() { } public void showMessage(String message) { + if (consoleView == null) { + return; + } consoleView.print(message, ConsoleViewContentType.SYSTEM_OUTPUT); } public void showError(Throwable exception) { + if (consoleView == null) { + return; + } String stacktrace = getStackTrace(exception); consoleView.print(stacktrace, ConsoleViewContentType.ERROR_OUTPUT); }