Skip to content

Commit

Permalink
Add null check when a view does not match an instrument (#3285)
Browse files Browse the repository at this point in the history
* Add null check when a view does not match an instrument

* Update changelog
  • Loading branch information
alanwest authored May 18, 2022
1 parent 55c5dd1 commit eb8844a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/OpenTelemetry/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Unreleased

* Fix null reference exception when a metric view does not match an instrument.
([#3285](https://github.com/open-telemetry/opentelemetry-dotnet/pull/3285))

## 1.3.0-beta.2

Released 2022-May-16
Expand Down
2 changes: 1 addition & 1 deletion src/OpenTelemetry/Metrics/MeterProviderSdk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ internal MeterProviderSdk(
// The SDK provides some static MetricStreamConfigurations.
// For example, the Drop configuration. The static ViewId
// should not be changed for these configurations.
if (!metricStreamConfig.ViewId.HasValue)
if (metricStreamConfig != null && !metricStreamConfig.ViewId.HasValue)
{
metricStreamConfig.ViewId = i;
}
Expand Down

0 comments on commit eb8844a

Please sign in to comment.