From 865d695bb1fe9ef1cd400f739979510d536f264f Mon Sep 17 00:00:00 2001 From: DocSvartz Date: Mon, 15 Dec 2025 19:46:03 +0500 Subject: [PATCH] fix: Map To Target Null regression --- src/Mapster/TypeAdapter.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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);