diff --git a/src/Mapster/TypeAdapter.cs b/src/Mapster/TypeAdapter.cs index 7a42ab4a..218045bf 100644 --- a/src/Mapster/TypeAdapter.cs +++ b/src/Mapster/TypeAdapter.cs @@ -105,8 +105,9 @@ public static TDestination Adapt(this TSource source, TDe if (sourceType == typeof(object)) // Infinity loop in ObjectAdapter if Runtime Type of source is Object return destination; - if (typeof(TSource) == typeof(object) || typeof(TDestination) == typeof(object)) - return UpdateFuncFromPackedinObject(source, destination, config, sourceType, destinationType); + if (typeof(TSource) == typeof(object) || typeof(TDestination) == typeof(object)) + if(sourceType != null && destinationType != null) + return UpdateFuncFromPackedinObject(source, destination, config, sourceType, destinationType); var fn = config.GetMapToTargetFunction(); return fn(source, destination);