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 =
|
proc getMsgName*(peer: Peer, msgId: int): string =
|
||||||
if not peer.dispatcher.isNil and
|
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
|
return peer.dispatcher.messages[msgId].name
|
||||||
else:
|
else:
|
||||||
return case msgId
|
return case msgId
|
||||||
|
|
Loading…
Reference in New Issue