aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-04-20 18:30:33 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-04-20 18:30:33 +0000
commit9f2f1c916901f4fd0467cd7078e92c6637ed00de (patch)
treeaa81ef9e0cb2ded4db456c802b6283efcad97fd6
parent08d30377733c4c59ecb8d806a7ba2faf4388081d (diff)
downloadpaludis-9f2f1c916901f4fd0467cd7078e92c6637ed00de.tar.gz
paludis-9f2f1c916901f4fd0467cd7078e92c6637ed00de.tar.xz
Don't do silly things when given 0 as a version
-rw-r--r--paludis/version_spec.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/paludis/version_spec.cc b/paludis/version_spec.cc
index 9fab178..08b45e8 100644
--- a/paludis/version_spec.cc
+++ b/paludis/version_spec.cc
@@ -151,7 +151,7 @@ VersionSpec::VersionSpec(const std::string & text) :
}
_imp->parts.push_back(Part(number, x));
- while (! _imp->parts.empty())
+ while (_imp->parts.size() > 1)
{
if (0 == _imp->parts[_imp->parts.size() - 1].get<part_value>())
_imp->parts.pop_back();
@@ -344,6 +344,8 @@ std::size_t
VersionSpec::hash_value() const
{
/// \todo Improve this;
+ if (_imp->parts.empty())
+ return 0;
return _imp->parts[0].get<part_value>();
}