mirror of
https://github.com/NixOS/nix
synced 2025-06-25 02:21:16 +02:00
Make EvalState::getBuiltin safe for missing attr
This commit is contained in:
parent
3b76d01f3b
commit
a58e38dab7
2 changed files with 10 additions and 1 deletions
|
@ -525,7 +525,11 @@ Value * EvalState::addPrimOp(PrimOp && primOp)
|
|||
|
||||
Value & EvalState::getBuiltin(const std::string & name)
|
||||
{
|
||||
return *baseEnv.values[0]->attrs()->find(symbols.create(name))->value;
|
||||
auto it = baseEnv.values[0]->attrs()->get(symbols.create(name));
|
||||
if (it)
|
||||
return *it->value;
|
||||
else
|
||||
throw EvalError("builtin '%1%' not found", name);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue