Skip to content

Commit

Permalink
Fix equality comparison in FluxJsonSetContext
Browse files Browse the repository at this point in the history
  • Loading branch information
ligowsky authored and YuriyDurov committed Jan 8, 2024
1 parent 6fd0f70 commit f48213f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public Task<TModel> GetAsync(TKey? id, params object[]? parameters)
if (SetOptions.KeyPropertyExpression is null) throw new FluxKeyPropertyExpressionMissingException<TModel>();

var itemId = SetOptions.KeyPropertyExpression.Compile().Invoke(item);
return Equals(itemId, id);
return itemId is not null && itemId.Equals(id);
}) ?? throw new FluxItemNotFoundException<TModel>(id);

return Task.FromResult(existingItem);
Expand Down
2 changes: 1 addition & 1 deletion src/BitzArt.Flux.Json/Models/FluxJsonSetContext{TModel}.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public virtual Task<TModel> GetAsync(object? id, params object[]? parameters)
if (SetOptions.KeyPropertyExpression is null) throw new FluxKeyPropertyExpressionMissingException<TModel>();

var itemId = SetOptions.KeyPropertyExpression.Compile().Invoke(item);
return Equals(itemId, id);
return itemId.Equals(id);
}) ?? throw new FluxItemNotFoundException<TModel>(id);

return Task.FromResult(existingItem);
Expand Down

0 comments on commit f48213f

Please sign in to comment.