From 0feefab9cebd92f962073a1e8a5d3bfe933f5851 Mon Sep 17 00:00:00 2001 From: Jordan Hrycaj Date: Mon, 21 Feb 2022 12:43:34 +0000 Subject: [PATCH] Prevent from NULL-message SEGFAULTs why: There were cases with NULL entries in the message sequence (as indexed by msgId.) --- eth/p2p/rlpx.nim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eth/p2p/rlpx.nim b/eth/p2p/rlpx.nim index bc0bb33..2880146 100644 --- a/eth/p2p/rlpx.nim +++ b/eth/p2p/rlpx.nim @@ -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