Skip to content

Commit

Permalink
Fixing a crash bug in GeneratorTypeReplacer
Browse files Browse the repository at this point in the history
  • Loading branch information
masonwheeler committed Aug 3, 2017
1 parent d056389 commit 2d77039
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@ public static IType MapTypeInMethodContext(IType type, Ast.Method method, out Ge
.Select(gp => (IGenericParameter) gp.Entity).ToArray();
mapper = new GeneratorTypeReplacer();
foreach (var genParam in type.GenericInfo.GenericParameters)
mapper.Replace(genParam, allGenParams.First(gp => gp.Name.Equals(genParam.Name)));
{
var replacement = allGenParams.FirstOrDefault(gp => gp.Name.Equals(genParam.Name));
if (replacement != null)
mapper.Replace(genParam, replacement);
}
return mapper.MapType(type);
}
mapper = null;
Expand Down

0 comments on commit 2d77039

Please sign in to comment.