p2p/discv5: fix topic register panic at shutdown

This commit is contained in:
Zsolt Felfoldi 2018-01-23 01:36:20 +01:00
parent 5d4267911a
commit 2d3c9cc476

View file

@ -350,7 +350,7 @@ func (s *ticketStore) nextFilteredTicket() (*ticketRef, time.Duration) {
regTime := now + mclock.AbsTime(wait)
topic := ticket.t.topics[ticket.idx]
if regTime >= s.tickets[topic].nextReg {
if s.tickets[topic] != nil && regTime >= s.tickets[topic].nextReg {
return ticket, wait
}
s.removeTicketRef(*ticket)