check for nil observers

This commit is contained in:
Dmitriy Ryajov 2020-05-08 15:44:18 -06:00
parent ccd019b328
commit 6196d56fc2
No known key found for this signature in database
GPG Key ID: DA8C680CE7C657A4
1 changed files with 1 additions and 1 deletions

View File

@ -83,7 +83,7 @@ proc send*(p: PubSubPeer, msgs: seq[RPCMsg]) {.async.} =
trace "sending msgs to peer", toPeer = p.id trace "sending msgs to peer", toPeer = p.id
let encoded = encodeRpcMsg(m) let encoded = encodeRpcMsg(m)
# trigger hooks # trigger hooks
if p.observers[].len > 0: if not(isNil(p.observers)) and p.observers[].len > 0:
var mm = m var mm = m
for obs in p.observers[]: for obs in p.observers[]:
obs.onSend(p, mm) obs.onSend(p, mm)