aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/derived-path.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2022-12-15 18:15:23 +0100
committerGitHub <noreply@github.com>2022-12-15 18:15:23 +0100
commit26c7602c390f8c511f326785b570918b2f468892 (patch)
tree71d3df010b0d863bd2014fc4407d1dc7db3ac1c6 /src/libstore/derived-path.cc
parent5d77c08858096a3d8f95735ec2227c544f5cdb9c (diff)
parent0687e16c4afd131540181cc66136418ac1cb845c (diff)
Merge pull request #7465 from edolstra/impure-derivations-dry-run
Fix a crash in DerivedPath::Built::toJSON() with impure derivations
Diffstat (limited to 'src/libstore/derived-path.cc')
-rw-r--r--src/libstore/derived-path.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/libstore/derived-path.cc b/src/libstore/derived-path.cc
index 05c2303db..3fa5ae4f7 100644
--- a/src/libstore/derived-path.cc
+++ b/src/libstore/derived-path.cc
@@ -20,11 +20,12 @@ nlohmann::json DerivedPath::Built::toJSON(ref<Store> store) const {
// Fallback for the input-addressed derivation case: We expect to always be
// able to print the output paths, so let’s do it
const auto knownOutputs = store->queryPartialDerivationOutputMap(drvPath);
- for (const auto& output : outputs) {
+ for (const auto & output : outputs) {
auto knownOutput = get(knownOutputs, output);
- res["outputs"][output] = (knownOutput && *knownOutput)
- ? store->printStorePath(**knownOutput)
- : nullptr;
+ if (knownOutput && *knownOutput)
+ res["outputs"][output] = store->printStorePath(**knownOutput);
+ else
+ res["outputs"][output] = nullptr;
}
return res;
}