[crash] fix nil pointer error #749

Signed-off-by: Leo Chen <leo@harmony.one>
pull/750/head
Leo Chen 6 years ago
parent 78323c11e3
commit a88eb643e6
  1. 3
      p2p/host/hostv2/hostv2.go

@ -87,6 +87,9 @@ func (r *GroupReceiverImpl) Close() error {
func (r *GroupReceiverImpl) Receive(ctx context.Context) (
msg []byte, sender libp2p_peer.ID, err error,
) {
if r.sub == nil {
return nil, libp2p_peer.ID(""), fmt.Errorf("Receive: r.sub == nil")
}
m, err := r.sub.Next(ctx)
if err == nil {
msg = m.Data

Loading…
Cancel
Save