aboutsummaryrefslogtreecommitdiff
path: root/src/nix-env
diff options
context:
space:
mode:
authorNaïm Favier <n@monade.li>2022-08-19 00:33:46 +0200
committerNaïm Favier <n@monade.li>2022-08-19 01:00:10 +0200
commit7535ee345da6c0aea1dd81e7de7725b37d8bf8a1 (patch)
treef8601b33374f66599a3e1ce89737209f5337be78 /src/nix-env
parent8188b1d0abc2eba6497b5dc47f7e848cbacb7677 (diff)
nix-env: don't output incomplete JSON
Diffstat (limited to 'src/nix-env')
-rw-r--r--src/nix-env/nix-env.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nix-env/nix-env.cc b/src/nix-env/nix-env.cc
index a69d3700d..fdd66220a 100644
--- a/src/nix-env/nix-env.cc
+++ b/src/nix-env/nix-env.cc
@@ -940,12 +940,12 @@ static void queryJSON(Globals & globals, std::vector<DrvInfo> & elems, bool prin
JSONObject metaObj = pkgObj.object("meta");
StringSet metaNames = i.queryMetaNames();
for (auto & j : metaNames) {
- auto placeholder = metaObj.placeholder(j);
Value * v = i.queryMeta(j);
if (!v) {
printError("derivation '%s' has invalid meta attribute '%s'", i.queryName(), j);
- placeholder.write(nullptr);
+ metaObj.attr(j, nullptr);
} else {
+ auto placeholder = metaObj.placeholder(j);
PathSet context;
printValueAsJSON(*globals.state, true, *v, noPos, placeholder, context);
}