diff options
Diffstat (limited to 'src/libexpr')
-rw-r--r-- | src/libexpr/attr-set.hh | 6 | ||||
-rw-r--r-- | src/libexpr/primops.cc | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/libexpr/attr-set.hh b/src/libexpr/attr-set.hh index d6af99912..118c7bd5d 100644 --- a/src/libexpr/attr-set.hh +++ b/src/libexpr/attr-set.hh @@ -64,12 +64,12 @@ public: return end(); } - std::optional<Attr *> get(const Symbol & name) + Attr * get(const Symbol & name) { Attr key(name, 0); iterator i = std::lower_bound(begin(), end(), key); if (i != end() && i->name == name) return &*i; - return {}; + return nullptr; } Attr & need(const Symbol & name, const Pos & pos = noPos) @@ -77,7 +77,7 @@ public: auto a = get(name); if (!a) throw Error("attribute '%s' missing, at %s", name, pos); - return **a; + return *a; } iterator begin() { return &attrs[0]; } diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index 3ef827ebc..29302c9b6 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -731,6 +731,8 @@ static void prim_derivationStrict(EvalState & state, const Pos & pos, Value * * the hash. */ for (auto & i : outputs) { if (!jsonObject) drv.env[i] = ""; + drv.outputs.insert_or_assign(i, + DerivationOutput(StorePath::dummy.clone(), "", "")); } Hash h = hashDerivationModulo(*state.store, Derivation(drv), true); |