Reporter | rune funch (rune.funch) |
---|---|
Created | Mar 7, 2012 12:41:03 AM |
Updated | Mar 7, 2012 12:41:03 AM |
Priority | Normal |
Type | Unspecified |
Fix versions | No Fix versions |
State | Submitted |
Assignee | Unassigned |
Subsystem | No subsystem |
Affected versions | No Affected versions |
Fixed in build | No Fixed in build |
THe below code results in a possible null ref at argumentTypes[i] which is incorrect since argumentTypes can only be null it arguments is null and there's an explicit check for that not being the case
var argumentTypes = arguments == null ? null : new TypeSpec[arguments.Count];
if (arguments != null){
for (var i = 0; i < arguments.Count;i++ ){
var argument = arguments[i];
if (argument.Type == null)
argument.Resolve(ec);
argumentTypes[i] = argument.Type;
}
}
var argumentTypes = arguments == null ? null : new TypeSpec[arguments.Count];
if (arguments != null){
for (var i = 0; i < arguments.Count;i++ ){
var argument = arguments[i];
if (argument.Type == null)
argument.Resolve(ec);
argumentTypes[i] = argument.Type;
}
}