diff options
Diffstat (limited to 'internal/pkg/apiutil')
-rw-r--r-- | internal/pkg/apiutil/util.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/internal/pkg/apiutil/util.go b/internal/pkg/apiutil/util.go index 1dd25c79..7eb3ee86 100644 --- a/internal/pkg/apiutil/util.go +++ b/internal/pkg/apiutil/util.go @@ -17,6 +17,7 @@ package apiutil import ( "encoding/json" + "fmt" "net" "time" @@ -90,6 +91,9 @@ func getNLRI(family bgp.RouteFamily, buf []byte) (bgp.AddrPrefixInterface, error } func GetNativeNlri(p *api.Path) (bgp.AddrPrefixInterface, error) { + if p.Family == nil { + return nil, fmt.Errorf("family cannot be nil") + } if len(p.NlriBinary) > 0 { return getNLRI(ToRouteFamily(p.Family), p.NlriBinary) } |