From aac88a8fadf44be9540f821b455fec1a268fd88a Mon Sep 17 00:00:00 2001 From: ston1th Date: Sun, 26 Sep 2021 19:30:58 +0200 Subject: [PATCH] fixed nil pointer --- alloc.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/alloc.go b/alloc.go index d9dc250..c4aab2b 100644 --- a/alloc.go +++ b/alloc.go @@ -64,7 +64,10 @@ func (a *GenericAlloc) Alloc() (ip *net.IPAddr, err error) { func (a *GenericAlloc) AllocCIDR() (cidr string, err error) { ip, err := a.Alloc() - return CIDR(a.prefix, ip), err + if err != nil { + return + } + return CIDR(a.prefix, ip), nil } func (a *GenericAlloc) Free(ip *net.IPAddr) (err error) {