Skip to content

Commit

Permalink
null check in Run.getEnvironment
Browse files Browse the repository at this point in the history
  • Loading branch information
huybrechts committed Oct 16, 2010
1 parent 97f5e8d commit d71ca9a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion core/src/main/java/hudson/model/Run.java
Original file line number Diff line number Diff line change
Expand Up @@ -1691,7 +1691,13 @@ public EnvVars getEnvironment() throws IOException, InterruptedException {
* @since 1.305
*/
public EnvVars getEnvironment(TaskListener log) throws IOException, InterruptedException {
EnvVars env = Computer.currentComputer().getEnvironment().overrideAll(getCharacteristicEnvVars());
Computer currentComputer = Computer.currentComputer();
EnvVars env = new EnvVars();
if (currentComputer != null) {
// currentComputer == null when this is called outside a running build
env.overrideAll(currentComputer.getEnvironment());;
}
env.overrideAll(getCharacteristicEnvVars());
String rootUrl = Hudson.getInstance().getRootUrl();
if(rootUrl!=null) {
env.put("HUDSON_URL", rootUrl);
Expand Down

0 comments on commit d71ca9a

Please sign in to comment.