mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-05 17:05:50 +02:00
multi: prevent nil panics in stop methods.
With this PR we might call the stop method even when the start method of a subsystem did not successfully finish therefore we need to make sure we guard the stop methods for potential panics if some variables are not initialized in the contructors of the subsystems.
This commit is contained in:
@@ -151,7 +151,12 @@ func (b *BitcoindNotifier) Stop() error {
|
||||
|
||||
close(epochClient.epochChan)
|
||||
}
|
||||
b.txNotifier.TearDown()
|
||||
|
||||
// The txNotifier is only initialized in the start method therefore we
|
||||
// need to make sure we don't access a nil pointer here.
|
||||
if b.txNotifier != nil {
|
||||
b.txNotifier.TearDown()
|
||||
}
|
||||
|
||||
// Stop the mempool notifier.
|
||||
b.memNotifier.TearDown()
|
||||
|
Reference in New Issue
Block a user