From c375465955acd24ca0202f59bec02f0d64694d4b Mon Sep 17 00:00:00 2001 From: Eduard Bagdasaryan Date: Tue, 3 Oct 2023 14:40:02 +0000 Subject: [PATCH] Fix handling of zero cache_peers (#1499) The bug was introduced in recent commit 2e24d0b. --- src/neighbors.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/neighbors.cc b/src/neighbors.cc index 3cf963b7f41..4b2a8bda3a0 100644 --- a/src/neighbors.cc +++ b/src/neighbors.cc @@ -1502,8 +1502,10 @@ dump_peers(StoreEntry *sentry, CachePeers *peers) char ntoabuf[MAX_IPSTRLEN]; int i; - if (peers == nullptr) + if (!peers) { storeAppendPrintf(sentry, "There are no neighbors installed.\n"); + return; + } for (const auto &peer: *peers) { const auto e = peer.get();