From 2646bc5a094241a7dd2b4f92e040f1ab452a3909 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 4 Jun 2024 15:45:01 +0300 Subject: Fix brep-load potential crash introduced by previous commit --- load/load.cxx | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/load/load.cxx b/load/load.cxx index 4d910ac..2b2cd56 100644 --- a/load/load.cxx +++ b/load/load.cxx @@ -1497,24 +1497,24 @@ detect_dependency_cycle (const package_id& id, throw failed (); } - // Note that the package can be an unresolved dependency and may not be - // present in the database. - // - if (shared_ptr p = db.find (id)) - { - chain.push_back (id); + chain.push_back (id); - for (const auto& das: p->dependencies) + shared_ptr p (db.load (id)); + for (const auto& das: p->dependencies) + { + for (const auto& da: das) { - for (const auto& da: das) + for (const auto& d: da) { - for (const auto& d: da) + // Skip unresolved dependencies. + // + if (d.package != nullptr) detect_dependency_cycle (d.package.object_id (), chain, db); } } - - chain.pop_back (); } + + chain.pop_back (); } // Return the certificate information for a signed repository and nullopt for -- cgit v1.1