From 4a4521f46253e87a06af9333381c050e983b3c2f Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 20 Feb 2020 23:47:02 +0100 Subject: [PATCH] Fix nlohmann::json exception --- src/libstore/fetchers/registry.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libstore/fetchers/registry.cc b/src/libstore/fetchers/registry.cc index fad389d17..721af0c9b 100644 --- a/src/libstore/fetchers/registry.cc +++ b/src/libstore/fetchers/registry.cc @@ -64,7 +64,8 @@ void Registry::write(const Path & path) nlohmann::json obj; obj["from"] = attrsToJson(std::get<0>(elem)->toAttrs()); obj["to"] = attrsToJson(std::get<1>(elem)->toAttrs()); - obj["to"].update(attrsToJson(std::get<2>(elem))); + if (!std::get<2>(elem).empty()) + obj["to"].update(attrsToJson(std::get<2>(elem))); arr.emplace_back(std::move(obj)); }