mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-19 11:20:45 +00:00
add nil check in defer
This commit is contained in:
parent
4f75049ea0
commit
a86d0510d1
1 changed files with 3 additions and 1 deletions
|
|
@ -442,7 +442,9 @@ func (f *TxFetcher) loop() {
|
||||||
if f.chain != nil {
|
if f.chain != nil {
|
||||||
headEventCh = make(chan core.ChainEvent, 10)
|
headEventCh = make(chan core.ChainEvent, 10)
|
||||||
sub := f.chain.SubscribeChainEvent(headEventCh)
|
sub := f.chain.SubscribeChainEvent(headEventCh)
|
||||||
defer sub.Unsubscribe()
|
if sub != nil {
|
||||||
|
defer sub.Unsubscribe()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for {
|
for {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue