diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2022-12-15 18:15:23 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-15 18:15:23 +0100 |
commit | 26c7602c390f8c511f326785b570918b2f468892 (patch) | |
tree | 71d3df010b0d863bd2014fc4407d1dc7db3ac1c6 /src | |
parent | 5d77c08858096a3d8f95735ec2227c544f5cdb9c (diff) | |
parent | 0687e16c4afd131540181cc66136418ac1cb845c (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')
-rw-r--r-- | src/libstore/derived-path.cc | 9 |
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; } |