diff options
Diffstat (limited to 'src/libexpr/attr-set.cc')
-rw-r--r-- | src/libexpr/attr-set.cc | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/libexpr/attr-set.cc b/src/libexpr/attr-set.cc index 9ac5e603199a..910428c02686 100644 --- a/src/libexpr/attr-set.cc +++ b/src/libexpr/attr-set.cc @@ -29,13 +29,17 @@ Bindings * EvalState::allocBindings(Bindings::size_t capacity) } -void EvalState::mkAttrs(Value & v, unsigned int expected) +void EvalState::mkAttrs(Value & v, unsigned int capacity) { + if (capacity == 0) { + v = vEmptySet; + return; + } clearValue(v); v.type = tAttrs; - v.attrs = allocBindings(expected); + v.attrs = allocBindings(capacity); nrAttrsets++; - nrAttrsInAttrsets += expected; + nrAttrsInAttrsets += capacity; } |