diff --git a/nano/node/transport/tcp.cpp b/nano/node/transport/tcp.cpp index 6dab450206..5f280abf68 100644 --- a/nano/node/transport/tcp.cpp +++ b/nano/node/transport/tcp.cpp @@ -197,8 +197,10 @@ std::unordered_set> nano::transport::t for (auto i (0); i < random_cutoff && result.size () < count_a; ++i) { auto index (nano::random_pool::generate_word32 (0, static_cast (peers_size - 1))); + release_assert (index < channels.size ()); auto channel = channels.get ()[index].channel; + release_assert (channel != nullptr); if (!channel->alive ()) { continue; @@ -588,11 +590,15 @@ void nano::transport::tcp_channels::ongoing_merge (size_t channel_index, nano::k void nano::transport::tcp_channels::list (std::deque> & deque_a, uint8_t minimum_version_a, bool include_temporary_channels_a) { nano::lock_guard lock{ mutex }; - // clang-format off - nano::transform_if (channels.get ().begin (), channels.get ().end (), std::back_inserter (deque_a), - [include_temporary_channels_a, minimum_version_a](auto & channel_a) { return channel_a.channel->get_network_version () >= minimum_version_a && (include_temporary_channels_a || !channel_a.channel->temporary); }, - [](auto const & channel) { return channel.channel; }); - // clang-format on + + nano::transform_if ( + channels.get ().begin (), channels.get ().end (), std::back_inserter (deque_a), + [include_temporary_channels_a, minimum_version_a] (auto & channel_a) { + release_assert (channel_a.channel != nullptr); + return channel_a.channel->get_network_version () >= minimum_version_a && (include_temporary_channels_a || !channel_a.channel->temporary); }, + [] (auto const & channel) { + return channel.channel; + }); } void nano::transport::tcp_channels::modify (std::shared_ptr const & channel_a, std::function const &)> modify_callback_a)