Skip to content

Commit dac89e4

Browse files
committed
fix(libexpr-c): nix_get_external should use check_value_in, not check_value_out
nix_get_external reads from an already-initialized nix_value (set via nix_init_external). Every other getter in the file (nix_get_bool, nix_get_int, nix_get_float, nix_get_string, nix_get_path_string) uses check_value_in, which asserts the value IS initialized. nix_get_external was the sole getter using check_value_out, which asserts the value is UNinitialized and throws "nix_value already initialized" for any valid external value — making the function always fail.
1 parent cbbc07c commit dac89e4

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/libexpr-c/nix_api_value.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ ExternalValue * nix_get_external(nix_c_context * context, nix_value * value)
335335
if (context)
336336
context->last_err_code = NIX_OK;
337337
try {
338-
auto & v = check_value_out(value);
338+
auto & v = check_value_in(value);
339339
assert(v.type() == nix::nExternal);
340340
return (ExternalValue *) v.external();
341341
}

0 commit comments

Comments
 (0)