From 11052b08caa3c933c5b6c9465e4c0716ef6bb445 Mon Sep 17 00:00:00 2001 From: lakshmia28 <42567192+lakshmia28@users.noreply.github.com> Date: Thu, 17 Apr 2025 14:15:03 +0000 Subject: [PATCH] Fixed nullreference exception for DateOfBirth in PlayerMappingProfile.cs --- .../Mappings/PlayerMappingProfile.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Dotnet.Samples.AspNetCore.WebApi/Mappings/PlayerMappingProfile.cs b/src/Dotnet.Samples.AspNetCore.WebApi/Mappings/PlayerMappingProfile.cs index e444719..6118ad7 100644 --- a/src/Dotnet.Samples.AspNetCore.WebApi/Mappings/PlayerMappingProfile.cs +++ b/src/Dotnet.Samples.AspNetCore.WebApi/Mappings/PlayerMappingProfile.cs @@ -37,7 +37,7 @@ public PlayerMappingProfile() ) .ForMember( destination => destination.Birth, - options => options.MapFrom(source => $"{source.DateOfBirth:MMMM d, yyyy}") + options => options.MapFrom(source =>source.DateOfBirth.HasValue? $"{source.DateOfBirth:MMMM d, yyyy}":string.Empty) ) .ForMember( destination => destination.Dorsal,