From 23ae91cfc1a541b7033126c284e9a2e5814836ca Mon Sep 17 00:00:00 2001 From: Imcom Jin Date: Tue, 23 Oct 2018 23:28:30 +0800 Subject: fix: nil pointer in PrefixSet Append --- internal/pkg/table/policy.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'internal/pkg/table') diff --git a/internal/pkg/table/policy.go b/internal/pkg/table/policy.go index 44feebd6..6e97723c 100644 --- a/internal/pkg/table/policy.go +++ b/internal/pkg/table/policy.go @@ -370,6 +370,12 @@ func (lhs *PrefixSet) Append(arg DefinedSet) error { if !ok { return fmt.Errorf("type cast failed") } + + if rhs.tree.Len() == 0 { + // if try to append an empty set, then return directly + return nil + } + // if either is empty, family can be ignored. if lhs.tree.Len() != 0 && rhs.tree.Len() != 0 { _, w, _ := lhs.tree.Minimum() -- cgit v1.2.3