mirror of
https://github.com/NixOS/nix
synced 2025-06-25 14:51:16 +02:00
fetchTree: Don't crash if narHash is missing
Fixes nix: ../src/libexpr/primops/fetchTree.cc:37: void nix::emitTreeAttrs(EvalState&, const StorePath&, const fetchers::Input&, Value&, bool, bool): Assertion `narHash' failed. on a lock file with an input that doesn't have a narHash. This can happen when using a lock file created by the lazy-trees branch. Cherry-picked from lazy-trees.
This commit is contained in:
parent
45b0158d91
commit
f4f4b698f6
1 changed files with 2 additions and 3 deletions
|
@ -33,9 +33,8 @@ void emitTreeAttrs(
|
|||
|
||||
// FIXME: support arbitrary input attributes.
|
||||
|
||||
auto narHash = input.getNarHash();
|
||||
assert(narHash);
|
||||
attrs.alloc("narHash").mkString(narHash->to_string(HashFormat::SRI, true));
|
||||
if (auto narHash = input.getNarHash())
|
||||
attrs.alloc("narHash").mkString(narHash->to_string(HashFormat::SRI, true));
|
||||
|
||||
if (input.getType() == "git")
|
||||
attrs.alloc("submodules").mkBool(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue