Skip to content

Commit

Permalink
Add check for null db parameter value (#161)
Browse files Browse the repository at this point in the history
  • Loading branch information
HoberMellow authored May 19, 2021
1 parent 55c1900 commit 9298acd
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions EF6.PG/NpgsqlServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ protected override void SetDbParameterValue(DbParameter parameter, TypeUsage par
// Npgsql > 4.0 does strict type checks on integral values and fails with enums passed with numeric DbType.
static void ConvertValueToNumericIfEnum(DbParameter parameter)
{
if (parameter.Value == null)
{
return;
}

var parameterValueObjectType = parameter.Value.GetType();

if (!parameterValueObjectType.IsEnum)
Expand Down

0 comments on commit 9298acd

Please sign in to comment.