diff --git a/src/Mapster.Tests/Mapster.Tests.csproj b/src/Mapster.Tests/Mapster.Tests.csproj
index e32640ca..a8795088 100644
--- a/src/Mapster.Tests/Mapster.Tests.csproj
+++ b/src/Mapster.Tests/Mapster.Tests.csproj
@@ -9,6 +9,7 @@
true
+
diff --git a/src/Mapster.Tests/WhenMappingArrays.cs b/src/Mapster.Tests/WhenMappingArrays.cs
index 7e72402a..c42ed8fe 100644
--- a/src/Mapster.Tests/WhenMappingArrays.cs
+++ b/src/Mapster.Tests/WhenMappingArrays.cs
@@ -2,6 +2,7 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Shouldly;
using System.Collections.Generic;
+using System.Linq.Expressions;
namespace Mapster.Tests
{
@@ -22,6 +23,16 @@ public void Single_Dimensional_Array_Is_Mapped()
target.Ints.ShouldBe(source.Ints);
}
+ [TestMethod]
+ public void MapToTarget_With_Null_Value()
+ {
+ var source = new FooArray { Ints = null };
+ var target = new BarArray { Ints = new int[] { 1, 2, 3, 4, 5 } };
+
+ TypeAdapter.Adapt(source, target);
+ target.Ints.ShouldBeNull();
+ }
+
[TestMethod]
public void Multi_Dimensional_Array_Is_Mapped()
{
diff --git a/src/Mapster/Adapters/BaseAdapter.cs b/src/Mapster/Adapters/BaseAdapter.cs
index 6e388bbb..db6d167b 100644
--- a/src/Mapster/Adapters/BaseAdapter.cs
+++ b/src/Mapster/Adapters/BaseAdapter.cs
@@ -185,7 +185,7 @@ protected Expression CreateBlockExpressionBody(Expression source, Expression des
var compareNull = Expression.Equal(source, Expression.Constant(null, source.Type));
set = Expression.IfThenElse(
compareNull,
- Expression.Assign(result, destination ?? arg.DestinationType.CreateDefault()),
+ Expression.Assign(result, arg.DestinationType.CreateDefault()),
set);
}
}
diff --git a/src/Mapster/Mapster.csproj b/src/Mapster/Mapster.csproj
index b521b5d8..87d37ef9 100644
--- a/src/Mapster/Mapster.csproj
+++ b/src/Mapster/Mapster.csproj
@@ -16,9 +16,9 @@
https://github.com/MapsterMapper/Mapster/blob/master/LICENSE
1.6.1
True
- 3.3.0
+ 3.3.1
Mapster
- 3.3.0.0
+ 3.3.1.0