fix: force the attrset before checking its type in Nix.hasAttr
This commit is contained in:
@@ -265,10 +265,11 @@ function selectWithDefault_impl(obj: NixValue, attrpath: NixValue[], default_val
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const hasAttr = (obj: NixValue, attrpath: NixValue[]): NixBool => {
|
export const hasAttr = (obj: NixValue, attrpath: NixValue[]): NixBool => {
|
||||||
if (!isAttrs(obj)) {
|
const forced = force(obj);
|
||||||
|
if (!isAttrs(forced)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
let attrs = obj;
|
let attrs = forced;
|
||||||
|
|
||||||
for (const attr of attrpath.slice(0, -1)) {
|
for (const attr of attrpath.slice(0, -1)) {
|
||||||
const cur = force(attrs[forceString(attr)]);
|
const cur = force(attrs[forceString(attr)]);
|
||||||
|
|||||||
Reference in New Issue
Block a user