Skip to content

Commit

Permalink
fix: fix nullable arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
TimothyMakkison committed Aug 3, 2023
1 parent d768dbb commit 6200409
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@ or CollectionType.IEnumerable
// a single Array.Clone / cast mapping call should be sufficient and fast,
// use a for loop mapping otherwise.
if (!elementMapping.IsSynthetic)
return new ArrayForMapping(ctx.Source, ctx.Target, elementMapping, elementMapping.TargetType);
return new ArrayForMapping(
ctx.Source,
ctx.Types.GetArrayType(elementMapping.TargetType),
elementMapping,
elementMapping.TargetType
);

return ctx.MapperConfiguration.UseDeepCloning
? new ArrayCloneMapping(ctx.Source, ctx.Target)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public partial class Mapper
return target;
}

private global::D[] MapToDArray(global::C[] source)
private global::D?[] MapToDArray(global::C[] source)
{
var target = new global::D?[source.Length];
for (var i = 0; i < source.Length; i++)
Expand All @@ -35,4 +35,4 @@ public partial class Mapper

return target;
}
}
}

0 comments on commit 6200409

Please sign in to comment.