aboutsummaryrefslogtreecommitdiff
path: root/load/load.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2024-06-04 15:45:01 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2024-06-04 15:45:01 +0300
commit2646bc5a094241a7dd2b4f92e040f1ab452a3909 (patch)
tree4921a8129ebff6d51a4f58157751f5203c6c2e0c /load/load.cxx
parent7fa296d5b67a345c708b762f01cec53fc4c00d99 (diff)
Fix brep-load potential crash introduced by previous commit
Diffstat (limited to 'load/load.cxx')
-rw-r--r--load/load.cxx22
1 files 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<package> p = db.find<package> (id))
- {
- chain.push_back (id);
+ chain.push_back (id);
- for (const auto& das: p->dependencies)
+ shared_ptr<package> p (db.load<package> (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