mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-24 01:15:29 +02:00
bug 357442: Protect EnvVarCollector against NPE when array of environment variables contains null
This commit is contained in:
parent
180b192054
commit
e034731fee
1 changed files with 22 additions and 20 deletions
|
@ -49,26 +49,28 @@ public class EnvVarCollector {
|
|||
boolean isCaseInsensitive = !EnvironmentVariableManager.getDefault().isVariableCaseSensitive();
|
||||
for(int i = 0; i < vars.length; i ++) {
|
||||
IEnvironmentVariable var = vars[i];
|
||||
String name = var.getName();
|
||||
if(isCaseInsensitive)
|
||||
name = name.toUpperCase();
|
||||
|
||||
boolean noCheck = false;
|
||||
|
||||
if(fMap == null){
|
||||
noCheck = true;
|
||||
fMap = new HashMap<String, EnvVarDescriptor>();
|
||||
}
|
||||
|
||||
EnvVarDescriptor des = null;
|
||||
if(noCheck || (des = fMap.get(name)) == null){
|
||||
des = new EnvVarDescriptor(var,info,num, supplier);
|
||||
fMap.put(name,des);
|
||||
}
|
||||
else {
|
||||
des.setContextInfo(info);
|
||||
des.setSupplierNum(num);
|
||||
des.setVariable(EnvVarOperationProcessor.performOperation(des.getOriginalVariable(),var));
|
||||
if (var != null) {
|
||||
String name = var.getName();
|
||||
if(isCaseInsensitive)
|
||||
name = name.toUpperCase();
|
||||
|
||||
boolean noCheck = false;
|
||||
|
||||
if(fMap == null){
|
||||
noCheck = true;
|
||||
fMap = new HashMap<String, EnvVarDescriptor>();
|
||||
}
|
||||
|
||||
EnvVarDescriptor des = null;
|
||||
if(noCheck || (des = fMap.get(name)) == null){
|
||||
des = new EnvVarDescriptor(var,info,num, supplier);
|
||||
fMap.put(name,des);
|
||||
}
|
||||
else {
|
||||
des.setContextInfo(info);
|
||||
des.setSupplierNum(num);
|
||||
des.setVariable(EnvVarOperationProcessor.performOperation(des.getOriginalVariable(),var));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue