check for nil envelopes

This commit is contained in:
Andrea Maria Piana 2023-02-08 12:10:07 +00:00
parent 9a598cc65b
commit 7d72281815
1 changed files with 4 additions and 0 deletions

View File

@ -1221,6 +1221,10 @@ func (w *Waku) Stop() error {
}
func (w *Waku) OnNewEnvelopes(envelope *protocol.Envelope, msgType common.MessageType) ([]common.EnvelopeError, error) {
if envelope == nil {
return nil, errors.New("nil envelope error")
}
recvMessage := common.NewReceivedMessage(envelope, msgType)
envelopeErrors := make([]common.EnvelopeError, 0)