Skip to content

Commit 865d695

Browse files
committed
fix: Map To Target Null regression
1 parent bf15fa4 commit 865d695

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Mapster/TypeAdapter.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,9 @@ public static TDestination Adapt<TSource, TDestination>(this TSource source, TDe
105105
if (sourceType == typeof(object)) // Infinity loop in ObjectAdapter if Runtime Type of source is Object
106106
return destination;
107107

108-
if (typeof(TSource) == typeof(object) || typeof(TDestination) == typeof(object))
109-
return UpdateFuncFromPackedinObject(source, destination, config, sourceType, destinationType);
108+
if (typeof(TSource) == typeof(object) || typeof(TDestination) == typeof(object))
109+
if(sourceType != null && destinationType != null)
110+
return UpdateFuncFromPackedinObject(source, destination, config, sourceType, destinationType);
110111

111112
var fn = config.GetMapToTargetFunction<TSource, TDestination>();
112113
return fn(source, destination);

0 commit comments

Comments
 (0)