mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-04 09:48:19 +01:00
lnd: prevent panic on nil neutrino cleanup
A cleanup closure is not included when an error is returned, causing the defer to execute and triggering the following panic: panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x105da38] goroutine 1 [running]: github.com/lightningnetwork/lnd.Main(0x2083e40, 0xc0004f6db0) /home/user/lnd/lnd.go:208 +0x2bfa main.main() /home/user/lnd/cmd/lnd/main.go:14 +0x26
This commit is contained in:
parent
616750184e
commit
e147445c08
1 changed files with 1 additions and 1 deletions
2
lnd.go
2
lnd.go
|
@ -203,10 +203,10 @@ func Main() error {
|
|||
neutrinoBackend, neutrinoCleanUp, err := initNeutrinoBackend(
|
||||
mainChain.ChainDir,
|
||||
)
|
||||
defer neutrinoCleanUp()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer neutrinoCleanUp()
|
||||
neutrinoCS = neutrinoBackend
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue