Skip to content

Commit

Permalink
Merge pull request #759 from DocSvartz/fix-null
Browse files Browse the repository at this point in the history
Fix null map to target regression
  • Loading branch information
andrerav authored Jan 13, 2025
2 parents b0d37ce + a4bda38 commit 425a7a9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Mapster/TypeAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ public static TDestination Adapt<TSource, TDestination>(this TSource source, TDe
/// <returns>Adapted destination type.</returns>
public static TDestination Adapt<TSource, TDestination>(this TSource source, TDestination destination, TypeAdapterConfig config)
{
var sourceType = source.GetType();
var destinationType = destination.GetType();
var sourceType = source?.GetType();
var destinationType = destination?.GetType();

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

0 comments on commit 425a7a9

Please sign in to comment.