Skip to content

Commit 425a7a9

Browse files
authored
Merge pull request #759 from DocSvartz/fix-null
Fix null map to target regression
2 parents b0d37ce + a4bda38 commit 425a7a9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Mapster/TypeAdapter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ public static TDestination Adapt<TSource, TDestination>(this TSource source, TDe
9696
/// <returns>Adapted destination type.</returns>
9797
public static TDestination Adapt<TSource, TDestination>(this TSource source, TDestination destination, TypeAdapterConfig config)
9898
{
99-
var sourceType = source.GetType();
100-
var destinationType = destination.GetType();
99+
var sourceType = source?.GetType();
100+
var destinationType = destination?.GetType();
101101

102102
if (sourceType == typeof(object)) // Infinity loop in ObjectAdapter if Runtime Type of source is Object
103103
return destination;

0 commit comments

Comments
 (0)