aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-11-01 22:49:47 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-11-01 22:49:47 +0000
commit485313eb8b584c2e6fa34826b497d1f898ccb409 (patch)
treeb74f48b2729a4662620f7308be7d69027264efbd
parent8be3d5b5a8a092ec2e2feb5886398d906c1952cd (diff)
downloadpaludis-485313eb8b584c2e6fa34826b497d1f898ccb409.tar.gz
paludis-485313eb8b584c2e6fa34826b497d1f898ccb409.tar.xz
Don't barf if raw_use_expand_key is zero
-rw-r--r--paludis/repositories/e/e_key.cc37
1 files changed, 19 insertions, 18 deletions
diff --git a/paludis/repositories/e/e_key.cc b/paludis/repositories/e/e_key.cc
index 344ed1c..ccf3922 100644
--- a/paludis/repositories/e/e_key.cc
+++ b/paludis/repositories/e/e_key.cc
@@ -1062,27 +1062,28 @@ EChoicesKey::value() const
MyOptionsFinder myoptions;
_imp->id->raw_myoptions_key()->value()->accept(myoptions);
- for (Set<std::string>::ConstIterator u(_imp->id->raw_use_expand_key()->value()->begin()),
- u_end(_imp->id->raw_use_expand_key()->value()->end()) ;
- u != u_end ; ++u)
- {
- Context local_local_context("When using raw_use_expand_key value '" + *u + "' to populate choices:");
+ if (_imp->id->raw_use_expand_key())
+ for (Set<std::string>::ConstIterator u(_imp->id->raw_use_expand_key()->value()->begin()),
+ u_end(_imp->id->raw_use_expand_key()->value()->end()) ;
+ u != u_end ; ++u)
+ {
+ Context local_local_context("When using raw_use_expand_key value '" + *u + "' to populate choices:");
- std::string lower_u;
- std::transform(u->begin(), u->end(), std::back_inserter(lower_u), &::tolower);
- std::tr1::shared_ptr<Choice> exp(new Choice(stringify(*u), lower_u, ChoicePrefixName(lower_u),
- false, hidden ? hidden->end() != hidden->find(*u) : false, false, true));
- _imp->value->add(exp);
+ std::string lower_u;
+ std::transform(u->begin(), u->end(), std::back_inserter(lower_u), &::tolower);
+ std::tr1::shared_ptr<Choice> exp(new Choice(stringify(*u), lower_u, ChoicePrefixName(lower_u),
+ false, hidden ? hidden->end() != hidden->find(*u) : false, false, true));
+ _imp->value->add(exp);
- MyOptionsFinder::Prefixes::iterator p(myoptions.prefixes.find(ChoicePrefixName(lower_u)));
- if (myoptions.prefixes.end() != p)
- {
- for (MyOptionsFinder::Values::const_iterator v(p->second.begin()), v_end(p->second.end()) ;
- v != v_end ; ++v)
- exp->add(make_myoption(_imp->id, exp, v, indeterminate, true));
- myoptions.prefixes.erase(p);
+ MyOptionsFinder::Prefixes::iterator p(myoptions.prefixes.find(ChoicePrefixName(lower_u)));
+ if (myoptions.prefixes.end() != p)
+ {
+ for (MyOptionsFinder::Values::const_iterator v(p->second.begin()), v_end(p->second.end()) ;
+ v != v_end ; ++v)
+ exp->add(make_myoption(_imp->id, exp, v, indeterminate, true));
+ myoptions.prefixes.erase(p);
+ }
}
- }
MyOptionsFinder::Prefixes::iterator p(myoptions.prefixes.find(ChoicePrefixName("")));
if (myoptions.prefixes.end() != p)