Fix panic on nil message
This commit is contained in:
parent
9ee8d0f867
commit
42173343fa
|
@ -484,9 +484,8 @@ func (mb *MessageBus) Subscribe(id, topic string, opts ...SubscribeOption) chan
|
|||
var n int
|
||||
log.Debugf("subscriber wants to start from %d", o.Index)
|
||||
q.ForEach(func(item interface{}) error {
|
||||
msg := item.(Message)
|
||||
log.Debugf("found #%v", msg)
|
||||
if msg.ID >= o.Index {
|
||||
if msg, ok := item.(Message); ok && msg.ID >= o.Index {
|
||||
log.Debugf("found #%v", msg)
|
||||
ch <- msg
|
||||
n++
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue