From 6851f0c2d06e2b22ff376d8f0912d1e9d7893a89 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Mon, 2 Aug 2021 22:40:16 +0300 Subject: Fix rep-fetch crash due to 'object not persistent' odb exception --- bpkg/rep-fetch.cxx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bpkg/rep-fetch.cxx b/bpkg/rep-fetch.cxx index 531f1d0..f6165b7 100644 --- a/bpkg/rep-fetch.cxx +++ b/bpkg/rep-fetch.cxx @@ -1265,7 +1265,14 @@ namespace bpkg // Remove dangling repositories. // for (const shared_ptr& r: removed_repositories) - rep_remove (db, t, r); + { + // Prior to removing the repository we need to make sure it still + // exists, which may not be the case due to earlier removal of the + // dependent dangling repository. + // + if (db.find (r->name) != nullptr) + rep_remove (db, t, r); + } // Remove dangling repository fragments. // -- cgit v1.1