diff options
author | Wataru Ishida <ishida.wataru@lab.ntt.co.jp> | 2016-11-16 09:41:10 -0500 |
---|---|---|
committer | Wataru Ishida <ishida.wataru@lab.ntt.co.jp> | 2016-11-16 09:41:10 -0500 |
commit | 285d4165acf04d8fa8b3e300282f40b2c11a0588 (patch) | |
tree | 6574906221f714abb4e4acb3c2ebcce134160136 /client/client.go | |
parent | e6f109a72c6e5b1056f82a840ce5af30188ce434 (diff) |
client: fix bug of GetNeighbor()
also add a unit test
Signed-off-by: Wataru Ishida <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'client/client.go')
-rw-r--r-- | client/client.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/client/client.go b/client/client.go index 734e7ec4..a2107637 100644 --- a/client/client.go +++ b/client/client.go @@ -143,6 +143,9 @@ func (cli *GoBGPClient) GetNeighbor(name string) (*config.Neighbor, error) { if err != nil { return nil, err } + if len(ns) == 0 { + return nil, fmt.Errorf("not found neighbor %s", name) + } return ns[0], nil } |