aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/local-store.cc
diff options
context:
space:
mode:
authorAlain Zscheile <zseri.devel@ytrizja.de>2022-05-04 07:44:32 +0200
committerGitHub <noreply@github.com>2022-05-04 07:44:32 +0200
commit1385b2007804c8a0370f2a6555045a00e34b07c7 (patch)
tree3f83e56e03bd60d6c07d0ee14e70949df04b9e0f /src/libstore/local-store.cc
parent9489b4b7ef73ab20e8f49213d8711ca56b59107e (diff)
Get rid of most `.at` calls (#6393)
Use one of `get` or `getOr` instead which will either return a null-pointer (with a nicer error message) or a default value when the key is missing.
Diffstat (limited to 'src/libstore/local-store.cc')
-rw-r--r--src/libstore/local-store.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc
index 5cc5c91cc..eba3b0fa5 100644
--- a/src/libstore/local-store.cc
+++ b/src/libstore/local-store.cc
@@ -718,7 +718,11 @@ void LocalStore::checkDerivationOutputs(const StorePath & drvPath, const Derivat
// somewhat expensive so we do lazily
hashesModulo = hashDerivationModulo(*this, drv, true);
}
- StorePath recomputed = makeOutputPath(i.first, hashesModulo->hashes.at(i.first), drvName);
+ auto currentOutputHash = get(hashesModulo->hashes, i.first);
+ if (!currentOutputHash)
+ throw Error("derivation '%s' has unexpected output '%s' (local-store / hashesModulo) named '%s'",
+ printStorePath(drvPath), printStorePath(doia.path), i.first);
+ StorePath recomputed = makeOutputPath(i.first, *currentOutputHash, drvName);
if (doia.path != recomputed)
throw Error("derivation '%s' has incorrect output '%s', should be '%s'",
printStorePath(drvPath), printStorePath(doia.path), printStorePath(recomputed));