Skip to content

Commit 4ce03e9

Browse files
authored
bugfix for get-azmetric (#15367)
1 parent 5adba8b commit 4ce03e9

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/Monitor/Monitor/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
-->
2020

2121
## Upcoming Release
22+
* Fixed null reference bug for `Get-AzMetric` when `ResultType` set to "Metadata"
2223
* Fixed bug for `Add-AzAutoscaleSetting` not able to pipe result from `Get-AzAutoscaleSetting` [#13861]
2324

2425
## Version 2.5.0

src/Monitor/Monitor/OutputClasses/PSMetric.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public PSMetric(Metric metric)
6262
this.Unit = metric.Unit;
6363
this.Id = metric.Id;
6464
this.Type = metric.Type;
65-
this.Data = ((metric.Timeseries != null && metric.Timeseries.Count > 0)? new PSMetricValuesCollection(metric.Timeseries[0].Data) : null);
65+
this.Data = ((metric.Timeseries != null && metric.Timeseries.Count > 0 && metric.Timeseries[0].Data != null)? new PSMetricValuesCollection(metric.Timeseries[0].Data) : null);
6666
this.Timeseries = metric.Timeseries;
6767
}
6868
}

0 commit comments

Comments
 (0)