From 6196d56fc28f8bf06a236c38d6038fafbe9f6561 Mon Sep 17 00:00:00 2001 From: Dmitriy Ryajov Date: Fri, 8 May 2020 15:44:18 -0600 Subject: [PATCH] check for nil observers --- libp2p/protocols/pubsub/pubsubpeer.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libp2p/protocols/pubsub/pubsubpeer.nim b/libp2p/protocols/pubsub/pubsubpeer.nim index 8e19f7d..ce5c156 100644 --- a/libp2p/protocols/pubsub/pubsubpeer.nim +++ b/libp2p/protocols/pubsub/pubsubpeer.nim @@ -83,7 +83,7 @@ proc send*(p: PubSubPeer, msgs: seq[RPCMsg]) {.async.} = trace "sending msgs to peer", toPeer = p.id let encoded = encodeRpcMsg(m) # trigger hooks - if p.observers[].len > 0: + if not(isNil(p.observers)) and p.observers[].len > 0: var mm = m for obs in p.observers[]: obs.onSend(p, mm)