Skip to content

Commit

Permalink
fix nil pointer in mergeEgressRulesByPorts
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Bertschy <[email protected]>
  • Loading branch information
matthyx committed Jul 16, 2024
1 parent 968527e commit 1a0f658
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,13 @@ func mergeEgressRulesByPorts(rules []softwarecomposition.NetworkPolicyEgressRule
}

for _, port := range rule.Ports {
key := PortProtocolKey{Port: *port.Port, Protocol: *port.Protocol}
key := PortProtocolKey{}
if port.Port != nil {
key.Port = *port.Port
}
if port.Protocol != nil {
key.Protocol = *port.Protocol
}
if _, exists := merged[key]; !exists {
keys = append(keys, key)
}
Expand Down

0 comments on commit 1a0f658

Please sign in to comment.