From 171cc435a43b37d7beeffcd5aa1372246da597e3 Mon Sep 17 00:00:00 2001 From: kohsuke Date: Sat, 20 Jan 2007 17:57:03 +0000 Subject: [PATCH] Fixed NPE. git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@1843 71c3de6d-444a-0410-be80-ed276b4c234a --- core/src/main/java/hudson/model/Computer.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/hudson/model/Computer.java b/core/src/main/java/hudson/model/Computer.java index edab23a8a7..bf1883a371 100644 --- a/core/src/main/java/hudson/model/Computer.java +++ b/core/src/main/java/hudson/model/Computer.java @@ -14,6 +14,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.TreeMap; +import java.util.Collections; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -239,7 +240,10 @@ public abstract class Computer implements ModelObject { * If this is the master, it returns the system property of the master computer. */ public Map getEnvVars() throws IOException, InterruptedException { - return getChannel().call(new GetEnvVars()); + VirtualChannel channel = getChannel(); + if(channel==null) + return Collections.singletonMap("N/A","N/A"); + return channel.call(new GetEnvVars()); } private static final class GetEnvVars implements Callable,RuntimeException> {