Skip to content

Commit

Permalink
fix: nil pointer in PrefixSet Append
Browse files Browse the repository at this point in the history
  • Loading branch information
imcom committed Oct 23, 2018
1 parent 8fc094c commit 23ae91c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/pkg/table/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 23ae91c

Please sign in to comment.