From b4daba718d3ff421f4f14fca0276eb18dc5b93e4 Mon Sep 17 00:00:00 2001 From: Mohammad Sadeq Sirjani Date: Sat, 22 Apr 2023 09:18:42 +0330 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(TypeAdapter.cs):=20make=20so?= =?UTF-8?q?urce=20parameter=20nullable=20The=20source=20parameter=20in=20t?= =?UTF-8?q?he=20Adapt=20method=20is=20now=20nullable,=20which=20allows=20f?= =?UTF-8?q?or=20null=20values=20to=20be=20passed=20in=20without=20throwing?= =?UTF-8?q?=20a=20null=20reference=20exception.=20This=20improves=20the=20?= =?UTF-8?q?robustness=20of=20the=20code=20and=20makes=20it=20more=20defens?= =?UTF-8?q?ive=20against=20unexpected=20null=20values.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Mapster/TypeAdapter.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Mapster/TypeAdapter.cs b/src/Mapster/TypeAdapter.cs index 8e1af524..794a7b57 100644 --- a/src/Mapster/TypeAdapter.cs +++ b/src/Mapster/TypeAdapter.cs @@ -21,7 +21,7 @@ public static TypeAdapterBuilder BuildAdapter(this TSource sou /// Destination type. /// Source object to adapt. /// Adapted destination type. - public static TDestination Adapt(this object source) + public static TDestination Adapt(this object? source) { return Adapt(source, TypeAdapterConfig.GlobalSettings); } @@ -33,7 +33,7 @@ public static TDestination Adapt(this object source) /// Source object to adapt. /// Configuration /// Adapted destination type. - public static TDestination Adapt(this object source, TypeAdapterConfig config) + public static TDestination Adapt(this object? source, TypeAdapterConfig config) { // ReSharper disable once ConditionIsAlwaysTrueOrFalse if (source == null)