Skip to content

Commit 10b8576

Browse files
add null check
1 parent 4313922 commit 10b8576

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/ResourceManager/Network/Commands.Network/NetworkInterface/NetworkInterfaceBaseCmdlet.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ public PSNetworkInterface GetScaleSetNetworkInterface(string resourceGroupName,
7979

8080
public void NullifyApplicationSecurityGroupIfAbsent(NetworkInterface nic)
8181
{
82+
if (nic.IpConfigurations == null)
83+
{
84+
return;
85+
}
86+
8287
// Temporary - to be removed
8388
foreach (var ipconfigModel in nic.IpConfigurations)
8489
{

src/ResourceManager/Network/Commands.Network/NetworkSecurityGroup/NetworkSecurityGroupBaseCmdlet.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ public PSNetworkSecurityGroup GetNetworkSecurityGroup(string resourceGroupName,
6767
// Temporary - to be removed
6868
public void NullifyApplicationSecurityGroupsIfAbsent(NetworkSecurityGroup nsg)
6969
{
70+
if (nsg.SecurityRules == null)
71+
{
72+
return;
73+
}
74+
7075
foreach (var rule in nsg.SecurityRules)
7176
{
7277
if (rule.SourceApplicationSecurityGroups != null && rule.SourceApplicationSecurityGroups.Count == 0)

0 commit comments

Comments
 (0)