Skip to content

Commit

Permalink
CSHARP-5154: Coverity analysis defect 138095: Dereference null return…
Browse files Browse the repository at this point in the history
… value.
  • Loading branch information
rstam committed Jun 26, 2024
1 parent 91222c9 commit a47dce3
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,13 @@ public static AstPipeline Translate(TranslationContext context, MethodCallExpres
if (secondValue is IMongoQueryable secondQueryable)
{
var secondProvider = (IMongoQueryProviderInternal)secondQueryable.Provider;
var secondCollectionName = secondProvider.CollectionNamespace.CollectionName;
var secondCollectionNamespace = secondProvider.CollectionNamespace;
if (secondCollectionNamespace == null)
{
throw new ExpressionNotSupportedException(expression, because: "second argument must be an IMongoQueryable against a collection");
}

var secondCollectionName = secondCollectionNamespace.CollectionName;
var secondPipelineInputSerializer = secondProvider.PipelineInputSerializer;
var secondContext = TranslationContext.Create(secondQueryable.Expression, secondPipelineInputSerializer);
var secondPipeline = ExpressionToPipelineTranslator.Translate(secondContext, secondQueryable.Expression);
Expand Down

0 comments on commit a47dce3

Please sign in to comment.