Correctly export empty universal variables

Fixes #5992
This commit is contained in:
ridiculousfish
2019-07-21 12:44:07 -07:00
parent 01dff25f62
commit e8c6de8055
4 changed files with 18 additions and 10 deletions

View File

@@ -638,12 +638,10 @@ std::shared_ptr<const null_terminated_array_t<char>> env_scoped_impl_t::create_e
const wcstring_list_t uni = uvars()->get_names(true, false);
for (const wcstring &key : uni) {
auto var = uvars()->get(key);
if (!var.missing_or_empty()) {
// Note that std::map::insert does NOT overwrite a value already in the map,
// which we depend on here.
vals.insert(std::pair<wcstring, env_var_t>(key, *var));
}
assert(var && "Variable should be present in uvars");
// Note that std::map::insert does NOT overwrite a value already in the map,
// which we depend on here.
vals.insert(std::make_pair(key, *var));
}
}