aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/gc.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2021-10-15 16:36:48 +0200
committerEelco Dolstra <edolstra@gmail.com>2021-10-15 16:36:48 +0200
commitac54c6faa6b73c3da180dec666fadd6e8d7d18e3 (patch)
treebddf76bb74d0336f303cd0c6b889bcfc394a1807 /src/libstore/gc.cc
parente0936ae38f110db68870b1d80d6c628172d12b4c (diff)
Fix main GC thread exiting
Diffstat (limited to 'src/libstore/gc.cc')
-rw-r--r--src/libstore/gc.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libstore/gc.cc b/src/libstore/gc.cc
index 220441927..648295684 100644
--- a/src/libstore/gc.cc
+++ b/src/libstore/gc.cc
@@ -538,8 +538,10 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results)
Finally cleanup([&]() {
auto conn(connections.lock());
auto i = conn->find(fdClient.get());
- i->second.detach();
- conn->erase(i);
+ if (i != conn->end()) {
+ i->second.detach();
+ conn->erase(i);
+ }
});
while (true) {