]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix handling of zero cache_peers (#1499)
authorEduard Bagdasaryan <eduard.bagdasaryan@measurement-factory.com>
Tue, 3 Oct 2023 14:40:02 +0000 (14:40 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Tue, 3 Oct 2023 14:40:12 +0000 (14:40 +0000)
The bug was introduced in recent commit 2e24d0b.

src/neighbors.cc

index 3cf963b7f41f6085624f8356abaa45b752d24964..4b2a8bda3a0c2e3d3709405129a33076deb0de72 100644 (file)
@@ -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();