summaryrefslogtreecommitdiffhomepage
path: root/internal/pkg/table
diff options
context:
space:
mode:
authorImcom Jin <jinyu.bjut@gmail.com>2018-10-23 23:28:30 +0800
committerImcom Jin <jinyu.bjut@gmail.com>2018-10-23 23:28:30 +0800
commit23ae91cfc1a541b7033126c284e9a2e5814836ca (patch)
tree0a3340bd55c78c34b0449443ca1d80ddc7f0cf7c /internal/pkg/table
parent8fc094cf6d8c531a559418b49f46d49998f56d09 (diff)
fix: nil pointer in PrefixSet Append
Diffstat (limited to 'internal/pkg/table')
-rw-r--r--internal/pkg/table/policy.go6
1 files changed, 6 insertions, 0 deletions
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()