Skip to content

Commit

Permalink
Query: Avoid potential null to bool cast
Browse files Browse the repository at this point in the history
Resolves #20498

Manually tested in debugger. Cannot write a test since LINQ Where requires bool and does not accept bool?
  • Loading branch information
smitpatel committed Apr 2, 2020
1 parent 2aaaa35 commit 5d15579
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/EFCore.Cosmos/Query/Internal/SelectExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ public virtual void ClearOrdering()
public virtual void ApplyPredicate([NotNull] SqlExpression expression)
{
if (expression is SqlConstantExpression sqlConstant
&& (bool)sqlConstant.Value)
&& sqlConstant.Value is bool)
{
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public void ApplyPredicate([NotNull] SqlExpression expression)
Check.NotNull(expression, nameof(expression));

if (expression is SqlConstantExpression sqlConstant
&& (bool)sqlConstant.Value)
&& sqlConstant.Value is bool)
{
return;
}
Expand Down

0 comments on commit 5d15579

Please sign in to comment.