aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/hash.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libutil/hash.cc')
-rw-r--r--src/libutil/hash.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libutil/hash.cc b/src/libutil/hash.cc
index 7caee1da7..3f6d4c0c9 100644
--- a/src/libutil/hash.cc
+++ b/src/libutil/hash.cc
@@ -205,6 +205,16 @@ Hash::Hash(const std::string & s, HashType type)
throw BadHash("hash '%s' has wrong length for hash type '%s'", s, printHashType(type));
}
+Hash newHashAllowEmpty(std::string hashStr, HashType ht)
+{
+ if (hashStr.empty())
+ {
+ Hash h(ht);
+ warn("found empty hash, assuming you wanted '%s'", h.to_string(SRI));
+ } else
+ return Hash(hashStr, ht);
+}
+
union Ctx
{