From 23d6bb583afb2b98cc9152911c12a37ba56d1e39 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 26 Mar 2018 23:34:25 +0200 Subject: [PATCH] LocalStore::addToStore: Throw an exception if no hash is given --- src/libstore/local-store.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc index ef8c2811b..681abafef 100644 --- a/src/libstore/local-store.cc +++ b/src/libstore/local-store.cc @@ -976,7 +976,8 @@ const PublicKeys & LocalStore::getPublicKeys() void LocalStore::addToStore(const ValidPathInfo & info, Source & source, RepairFlag repair, CheckSigsFlag checkSigs, std::shared_ptr accessor) { - assert(info.narHash); + if (!info.narHash) + throw Error("cannot add path '%s' because it lacks a hash", info.path); if (requireSigs && checkSigs && !info.checkSignatures(*this, getPublicKeys())) throw Error("cannot add path '%s' because it lacks a valid signature", info.path);