From 44daa6d3e6b462e79065fc1688b15b51c73a01d3 Mon Sep 17 00:00:00 2001
From: Max Kellermann <mk@cm4all.com>
Date: Wed, 4 Oct 2023 12:36:56 +0200
Subject: [PATCH] util/IntrusiveForwardList: reset last_cache properly in
 clear()

---
 src/util/IntrusiveForwardList.hxx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/util/IntrusiveForwardList.hxx b/src/util/IntrusiveForwardList.hxx
index 64954e617..fb6df7f78 100644
--- a/src/util/IntrusiveForwardList.hxx
+++ b/src/util/IntrusiveForwardList.hxx
@@ -185,7 +185,7 @@ public:
 
 	void clear() noexcept {
 		head = {};
-		last_cache = {};
+		last_cache = {&head};
 		counter.reset();
 	}
 
@@ -196,7 +196,7 @@ public:
 			disposer(item);
 		}
 
-		last_cache = {};
+		last_cache = {&head};
 	}
 
 	/**