Skip to content

Commit 20255cb

Browse files
author
Hovsep
committed
Merge pull request #1996 from AuxMon/dev
[Insights] Fix null object exception
2 parents 1c47402 + 8c15b9c commit 20255cb

File tree

2 files changed

+0
-20
lines changed

2 files changed

+0
-20
lines changed

src/ResourceManager/Insights/Commands.Insights/Diagnostics/GetAzureRmDiagnosticSettingCommand.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,6 @@ protected override void ProcessRecordInternal()
4141
{
4242
ServiceDiagnosticSettingsGetResponse result = this.InsightsManagementClient.ServiceDiagnosticSettingsOperations.GetAsync(this.ResourceId, CancellationToken.None).Result;
4343

44-
if (result.Properties != null && result.Properties.Logs != null && result.Properties.Logs.Count == 0)
45-
{
46-
result.Properties.Logs = null;
47-
}
48-
49-
if (result.Properties != null && result.Properties.Metrics != null && result.Properties.Metrics.Count == 0)
50-
{
51-
result.Properties.Metrics = null;
52-
}
53-
5444
PSServiceDiagnosticSettings psResult = new PSServiceDiagnosticSettings(result.Properties);
5545
WriteObject(psResult);
5646
}

src/ResourceManager/Insights/Commands.Insights/Diagnostics/SetAzureRmDiagnosticSettingCommand.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -171,16 +171,6 @@ protected override void ProcessRecordInternal()
171171

172172
putParameters.Properties = properties;
173173

174-
if (properties != null && properties.Logs != null && properties.Logs.Count == 0)
175-
{
176-
properties.Logs = null;
177-
}
178-
179-
if (properties != null && properties.Metrics != null && properties.Metrics.Count == 0)
180-
{
181-
properties.Metrics = null;
182-
}
183-
184174
this.InsightsManagementClient.ServiceDiagnosticSettingsOperations.PutAsync(this.ResourceId, putParameters, CancellationToken.None).Wait();
185175
PSServiceDiagnosticSettings psResult = new PSServiceDiagnosticSettings(putParameters.Properties);
186176
WriteObject(psResult);

0 commit comments

Comments
 (0)