Permalink
Browse files

defensive

  • Loading branch information...
1 parent 1c6fe2f commit 0f0bb094429f2f7fb713815e725986e17dca6b90 @JPMoresmau committed Feb 8, 2013
@@ -1105,8 +1105,12 @@ private synchronized void addBuildWrapperPath(ProcessBuilder pb){
if (path!=null){
Map<String,String> env=pb.environment();
String pathValue=env.get("PATH");
- if (Boolean.TRUE.equals(needPath) || !pathValue.contains(path)){
- pathValue+=File.pathSeparator+path;
+ if (Boolean.TRUE.equals(needPath) || pathValue==null || pathValue.length()==0 || !pathValue.contains(path)){
+ if (pathValue==null || pathValue.length()==0){
+ pathValue=path;
+ } else {
+ pathValue+=File.pathSeparator+path;
+ }
env.put("PATH",pathValue);
needPath=true;
}

0 comments on commit 0f0bb09

Please sign in to comment.