mirror of
https://github.com/netbirdio/netbird.git
synced 2025-06-20 17:58:02 +02:00
Fix nil pointer exception in error handling (#696)
In case if the wgctrl.New() return with err, should not close the resource.
This commit is contained in:
parent
2f0b652dad
commit
c3ed08c249
@ -127,12 +127,10 @@ func interfaceFilter(blackList []string) func(string) bool {
|
|||||||
wg, err := wgctrl.New()
|
wg, err := wgctrl.New()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Debugf("trying to create a wgctrl client failed with: %v", err)
|
log.Debugf("trying to create a wgctrl client failed with: %v", err)
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
defer func() {
|
defer func() {
|
||||||
err := wg.Close()
|
_ = wg.Close()
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}()
|
}()
|
||||||
|
|
||||||
_, err = wg.Device(iFace)
|
_, err = wg.Device(iFace)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user