mirror of
https://github.com/NixOS/nix.git
synced 2025-11-09 12:06:01 +01:00
Installable::getCursors: Cleanup
- Clarify doc comments, Installables::getCursors returns non-empty vector - Use vector::at in Installable::getCursor instead of checking for empty vector and throwing an exception with error message.
This commit is contained in:
parent
b26562c629
commit
377d5eb388
2 changed files with 9 additions and 6 deletions
|
|
@ -379,10 +379,9 @@ Installable::getCursors(EvalState & state)
|
|||
ref<eval_cache::AttrCursor>
|
||||
Installable::getCursor(EvalState & state)
|
||||
{
|
||||
auto cursors = getCursors(state);
|
||||
if (cursors.empty())
|
||||
throw Error("cannot find flake attribute '%s'", what());
|
||||
return cursors[0];
|
||||
/* Although getCursors should return at least one element, in case it doesn't,
|
||||
bound check to avoid an undefined behavior for vector[0] */
|
||||
return getCursors(state).at(0);
|
||||
}
|
||||
|
||||
static StorePath getDeriver(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue