diff options
author | Robert Hensing <robert@roberthensing.nl> | 2021-08-29 18:09:13 +0200 |
---|---|---|
committer | Robert Hensing <robert@roberthensing.nl> | 2021-08-29 18:11:58 +0200 |
commit | f10465774fafaa2423cb05e02b38e03ed2abded7 (patch) | |
tree | ce3c4e35b59ac3ad24c44b65d50ddd041fe70fcf /src/nix-env | |
parent | af94b54db3a2be100731a215cb5e95f306471731 (diff) |
Force all Pos* to be non-null
This fixes a class of crashes and introduces ptr<T> to make the
code robust against this failure mode going forward.
Thanks regnat for the idea of a ref<T> without overhead!
Closes #4895
Closes #4893
Closes #5127
Closes #5113
Diffstat (limited to 'src/nix-env')
-rw-r--r-- | src/nix-env/user-env.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nix-env/user-env.cc b/src/nix-env/user-env.cc index 5ceb2ae67..4b574fe0a 100644 --- a/src/nix-env/user-env.cc +++ b/src/nix-env/user-env.cc @@ -131,9 +131,9 @@ bool createUserEnv(EvalState & state, DrvInfos & elems, state.forceValue(topLevel); PathSet context; Attr & aDrvPath(*topLevel.attrs->find(state.sDrvPath)); - auto topLevelDrv = state.store->parseStorePath(state.coerceToPath(aDrvPath.pos ? *(aDrvPath.pos) : noPos, *(aDrvPath.value), context)); + auto topLevelDrv = state.store->parseStorePath(state.coerceToPath(*aDrvPath.pos, *(aDrvPath.value), context)); Attr & aOutPath(*topLevel.attrs->find(state.sOutPath)); - Path topLevelOut = state.coerceToPath(aOutPath.pos ? *(aOutPath.pos) : noPos, *(aOutPath.value), context); + Path topLevelOut = state.coerceToPath(*aOutPath.pos, *(aOutPath.value), context); /* Realise the resulting store expression. */ debug("building user environment"); |