mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-26 07:46:21 +02:00
Merge pull request #9934 from nmeum/absPath-out-of-bounds
absPath: Explicitly check if path is empty before accessing it
This commit is contained in:
commit
6ec08b85f6
1 changed files with 1 additions and 1 deletions
|
@ -25,7 +25,7 @@ Path absPath(PathView path, std::optional<PathView> dir, bool resolveSymlinks)
|
|||
{
|
||||
std::string scratch;
|
||||
|
||||
if (path[0] != '/') {
|
||||
if (path.empty() || path[0] != '/') {
|
||||
// In this case we need to call `canonPath` on a newly-created
|
||||
// string. We set `scratch` to that string first, and then set
|
||||
// `path` to `scratch`. This ensures the newly-created string
|
||||
|
|
Loading…
Reference in a new issue