diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2018-03-26T21·34+0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2018-05-30T11·25+0200 |
commit | 23d6bb583afb2b98cc9152911c12a37ba56d1e39 (patch) | |
tree | 0aa757ef854a1c6cd2f93fb91906c4f9c055d081 /src/libstore | |
parent | 3cab639e21fb39d6e0530910cf94b5bf60dbf5b3 (diff) |
LocalStore::addToStore: Throw an exception if no hash is given
Diffstat (limited to 'src/libstore')
-rw-r--r-- | src/libstore/local-store.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc index ef8c2811bd86..681abafef237 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<FSAccessor> 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); |