aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-01-26 11:11:15 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-01-26 11:11:15 +0000
commit41621ee7b0208891254f9cb012902b054d7ca360 (patch)
tree5477bb039c310a2828977ec13b58c2887ef7ae8b
parent979cf67ff1d92626a2e95e88d57759e5d9b6c38a (diff)
downloadpaludis-41621ee7b0208891254f9cb012902b054d7ca360.tar.gz
paludis-41621ee7b0208891254f9cb012902b054d7ca360.tar.xz
Use deps passed to DepList::add() directly (e.g. from the commandline) would result in an error. Make them work even if _implementation->current_package is 0.
-rw-r--r--paludis/dep_list.cc15
1 files changed, 8 insertions, 7 deletions
diff --git a/paludis/dep_list.cc b/paludis/dep_list.cc
index f907772..a7f3a85 100644
--- a/paludis/dep_list.cc
+++ b/paludis/dep_list.cc
@@ -367,15 +367,16 @@ DepList::visit(const PackageDepAtom * const p)
void
DepList::visit(const UseDepAtom * const u)
{
- if (! _implementation->current_package)
- throw InternalError(PALUDIS_HERE, "current_package is 0");
+ CountedPtr<PackageDatabaseEntry, count_policy::ExternalCountTag> e(0);
- PackageDatabaseEntry e(
- _implementation->current_package->get<dle_name>(),
- _implementation->current_package->get<dle_version>(),
- _implementation->current_package->get<dle_repository>());
+ if (_implementation->current_package)
+ e = CountedPtr<PackageDatabaseEntry, count_policy::ExternalCountTag>(
+ new PackageDatabaseEntry(
+ _implementation->current_package->get<dle_name>(),
+ _implementation->current_package->get<dle_version>(),
+ _implementation->current_package->get<dle_repository>()));
- if (_implementation->environment->query_use(u->flag(), &e) ^ u->inverse())
+ if (_implementation->environment->query_use(u->flag(), e.raw_pointer()) ^ u->inverse())
std::for_each(u->begin(), u->end(), std::bind1st(std::mem_fun(&DepList::_add), this));
}