mirror of
https://github.com/NixOS/nix.git
synced 2025-11-17 16:02:43 +01:00
C API: if store doesn't have a version, return an empty string
This commit is contained in:
parent
dfdb90dc8e
commit
24c8f6864d
3 changed files with 10 additions and 6 deletions
|
|
@ -72,11 +72,9 @@ nix_err nix_store_get_version(nix_c_context * context, Store * store, char * des
|
|||
context->last_err_code = NIX_OK;
|
||||
try {
|
||||
auto res = store->ptr->getVersion();
|
||||
if (res) {
|
||||
return nix_export_std_string(context, *res, dest, n);
|
||||
} else {
|
||||
return nix_set_err_msg(context, NIX_ERR_UNKNOWN, "store does not have a version");
|
||||
}
|
||||
if (!res)
|
||||
res = "";
|
||||
return nix_export_std_string(context, *res, dest, n);
|
||||
}
|
||||
NIXC_CATCH_ERRS
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue