diff options
-rw-r--r-- | server/peer.go | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/server/peer.go b/server/peer.go index 33ec9103..107a39fb 100644 --- a/server/peer.go +++ b/server/peer.go @@ -116,8 +116,10 @@ func (peer *Peer) setPolicy(policyMap map[string]*policy.Policy) { "Key": peer.peerConfig.NeighborAddress, "PolicyName": policyName, }).Info("import policy installed") - log.Debug("import policy : ", policyMap[policyName]) - inPolicies = append(inPolicies, policyMap[policyName]) + if pol, ok := policyMap[policyName]; ok { + log.Debug("import policy : ", pol) + inPolicies = append(inPolicies, pol) + } } peer.importPolicies = inPolicies @@ -129,8 +131,10 @@ func (peer *Peer) setPolicy(policyMap map[string]*policy.Policy) { "Key": peer.peerConfig.NeighborAddress, "PolicyName": policyName, }).Info("export policy installed") - log.Debug("export policy : ", policyMap[policyName]) - outPolicies = append(outPolicies, policyMap[policyName]) + if pol, ok := policyMap[policyName]; ok { + log.Debug("export policy : ", pol) + outPolicies = append(outPolicies, pol) + } } peer.exportPolicies = outPolicies } |