Skip to content

Commit 48ec90c

Browse files
committed
check for empty singular
1 parent c26d4cd commit 48ec90c

File tree

1 file changed

+4
-4
lines changed
  • services/network/networksecuritygroup

1 file changed

+4
-4
lines changed

services/network/networksecuritygroup/wssd.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -271,25 +271,25 @@ func getWssdNetworkSecurityGroupRules(securityRules *[]network.SecurityRule, isD
271271
return nil, errors.Wrapf(errors.InvalidInput, "Unknown Protocol %s specified", rule.Protocol)
272272
}
273273

274-
if rule.SourceAddressPrefix != nil {
274+
if rule.SourceAddressPrefix != nil && len(*rule.SourceAddressPrefix) > 0 {
275275
wssdCloudNSGRule.SourceAddressPrefix = *rule.SourceAddressPrefix
276276
} else if rule.SourceAddressPrefixes != nil {
277277
wssdCloudNSGRule.SourceAddressPrefix = strings.Join(*rule.SourceAddressPrefixes, ",")
278278
}
279279

280-
if rule.DestinationAddressPrefix != nil {
280+
if rule.DestinationAddressPrefix != nil && len(*rule.DestinationAddressPrefix) > 0 {
281281
wssdCloudNSGRule.DestinationAddressPrefix = *rule.DestinationAddressPrefix
282282
} else if rule.DestinationAddressPrefixes != nil {
283283
wssdCloudNSGRule.DestinationAddressPrefix = strings.Join(*rule.DestinationAddressPrefixes, ",")
284284
}
285285

286-
if rule.SourcePortRange != nil {
286+
if rule.SourcePortRange != nil && len(*rule.SourcePortRange) > 0 {
287287
wssdCloudNSGRule.SourcePortRange = *rule.SourcePortRange
288288
} else if rule.SourcePortRanges != nil {
289289
wssdCloudNSGRule.SourcePortRange = strings.Join(*rule.SourcePortRanges, ",")
290290
}
291291

292-
if rule.DestinationPortRange != nil {
292+
if rule.DestinationPortRange != nil && len(*rule.DestinationPortRange) > 0 {
293293
wssdCloudNSGRule.DestinationPortRange = *rule.DestinationPortRange
294294
} else if rule.DestinationPortRanges != nil {
295295
wssdCloudNSGRule.DestinationPortRange = strings.Join(*rule.DestinationPortRanges, ",")

0 commit comments

Comments
 (0)