Skip to content

Commit 1f00bb3

Browse files
author
Dhiren Sham
committed
Handle null
1 parent 38ece1e commit 1f00bb3

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/CouchDB.Driver/Query/QueryOptimizer.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,13 @@ protected override Expression VisitMethodCall(MethodCallExpression node)
105105

106106
while (_nextWhereCalls.Count > 0)
107107
{
108-
Expression nextWhereBody = _nextWhereCalls.Dequeue().GetLambdaBody();
109-
conditionExpression = Expression.AndAlso(nextWhereBody, conditionExpression);
110-
conditionExpression = Visit(conditionExpression);
108+
var call = _nextWhereCalls.Dequeue();
109+
if (call != null)
110+
{
111+
Expression nextWhereBody = call.GetLambdaBody();
112+
conditionExpression = Expression.AndAlso(nextWhereBody, conditionExpression);
113+
conditionExpression = Visit(conditionExpression);
114+
}
111115
}
112116

113117
if (conditionExpression.IsBoolean())

0 commit comments

Comments
 (0)