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:
Jordan Hrycaj 2022-02-21 12:43:34 +00:00
parent e794c149f5
commit 0feefab9ce
1 changed files with 2 additions and 1 deletions

View File

@ -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