Fixed NPE.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@1843 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
kohsuke committed 2007-01-20 17:57:03 +00:00
1 parent 82751e44a3
commit 171cc435a4
1 file changed
+5 -1
@@ -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<String,String> 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<Map<String,String>,RuntimeException> {