diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2021-08-02 22:40:16 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2021-08-03 17:18:15 +0300 |
commit | 6851f0c2d06e2b22ff376d8f0912d1e9d7893a89 (patch) | |
tree | 85d0934f8d739bd0ace6764b84e76cb38c055b64 | |
parent | 030785a98f0c61ed61f6f9669ba0bf46a3bcb6b9 (diff) |
Fix rep-fetch crash due to 'object not persistent' odb exception
-rw-r--r-- | bpkg/rep-fetch.cxx | 9 |
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. // |