Skip to content

Commit

Permalink
Fix CanonPath::dirOf() returning a string_view of a temporary
Browse files Browse the repository at this point in the history
  • Loading branch information
edolstra committed Dec 23, 2022
1 parent 17373de commit 64c60f7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/libutil/canon-path.hh
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public:
std::optional<std::string_view> dirOf() const
{
if (isRoot()) return std::nullopt;
return path.substr(0, path.rfind('/'));
return ((std::string_view) path).substr(0, path.rfind('/'));
}

std::optional<std::string_view> baseName() const
Expand Down

0 comments on commit 64c60f7

Please sign in to comment.