about summary refs log tree commit diff
path: root/src/libexpr
diff options
context:
space:
mode:
Diffstat (limited to 'src/libexpr')
-rw-r--r--src/libexpr/nixexpr.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libexpr/nixexpr.cc b/src/libexpr/nixexpr.cc
index 9f0bc2630ddc..bca2b7913b87 100644
--- a/src/libexpr/nixexpr.cc
+++ b/src/libexpr/nixexpr.cc
@@ -242,9 +242,10 @@ void ExprOpHasAttr::bindVars(const StaticEnv & env)
 
 void ExprAttrs::bindVars(const StaticEnv & env)
 {
-    const StaticEnv *dynamicEnv = &env;
+    const StaticEnv * dynamicEnv = &env;
+    StaticEnv newEnv(false, &env);
+
     if (recursive) {
-        StaticEnv newEnv(false, &env);
         dynamicEnv = &newEnv;
 
         unsigned int displ = 0;