mirror of https://github.com/status-im/nim-eth.git
Prevent from NULL-message SEGFAULTs
why: There were cases with NULL entries in the message sequence (as indexed by msgId.)
This commit is contained in:
parent
e794c149f5
commit
0feefab9ce
|
@ -207,7 +207,8 @@ proc getDispatcher(node: EthereumNode,
|
|||
|
||||
proc getMsgName*(peer: Peer, msgId: int): string =
|
||||
if not peer.dispatcher.isNil and
|
||||
msgId < peer.dispatcher.messages.len:
|
||||
msgId < peer.dispatcher.messages.len and
|
||||
not peer.dispatcher.messages[msgId].isNil:
|
||||
return peer.dispatcher.messages[msgId].name
|
||||
else:
|
||||
return case msgId
|
||||
|
|
Loading…
Reference in New Issue