From 432ca56fd3006ad424d620ecca3263863ce32b12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torbj=C3=B6rn=20Svensson?= Date: Sun, 15 Aug 2021 15:11:37 +0200 Subject: [PATCH] Only fetch result for jobs that has started MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In certain scenarios, the WSL detect job is not launched directly. As the join() method returns early for suspended jobs, the result list is read too early and causing NPE. This was deteced while running the JUnit tests. Contributed by STMicroelectronics Change-Id: I8a013cf83be26e8f8bee38fd2e7a4557eb1a57ab Signed-off-by: Torbjörn Svensson --- .../tm/terminal/view/ui/local/showin/detectors/DetectWSL.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terminal/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/local/showin/detectors/DetectWSL.java b/terminal/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/local/showin/detectors/DetectWSL.java index 2d07cd0ba86..dd315ea10f0 100644 --- a/terminal/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/local/showin/detectors/DetectWSL.java +++ b/terminal/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/local/showin/detectors/DetectWSL.java @@ -70,7 +70,7 @@ public class DetectWSL implements IDetectExternalExecutable { detectJob.schedule(); } try { - if (detectJob.join(10, null)) { + if (detectJob.join(10, null) && detectJob.result != null) { // Suspended jobs return early from join() result = detectJob.result; detectJob = null; } else {