github / github/codeql

LGTM.com - false positive - [cs/dereferenced-value-may-be-null]

Open
#8,505 2 comments 0 reactions 0 assignees View on GitHub
C# false-positive
Dominant language
CodeQL
Stars
10.1k
Forks
2.1k
Avg merge
2d 15h
Merged PRs (30d)
141

Description

**Description of the false positive**

Alert does not consider the order of events in the LINQ query; the value cannot be null.

**URL to the alert on the project page on LGTM.com**
https://lgtm.com/projects/g/DaveSkender/Stock.Indicators/snapshot/71ad67e9bc0c1c073362dc811972e76e48d98902/files/src/a-d/Dpo/Dpo.Utilities.cs?sort=name&dir=ASC&mode=heatmap#x73013381c2ffa1bb:1

```csharp
return results
.Where(x => x.Dpo != null)
.Select(x => new Quote
{
Date = x.Date,
Open = (decimal)x.Dpo,
High = (decimal)x.Dpo,
Low = (decimal)x.Dpo,
Close = (decimal)x.Dpo,
Volume = (decimal)x.Dpo
})
.ToList();
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.