aboutsummaryrefslogtreecommitdiff
path: root/bpkg/rep-fetch.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'bpkg/rep-fetch.cxx')
-rw-r--r--bpkg/rep-fetch.cxx9
1 files changed, 8 insertions, 1 deletions
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<repository>& 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<repository> (r->name) != nullptr)
+ rep_remove (db, t, r);
+ }
// Remove dangling repository fragments.
//