mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 08:16:15 +02:00
Value::mkString: Avoid crash from null string_view
This commit is contained in:
parent
c28e2b1b29
commit
1b978596b5
1 changed files with 7 additions and 1 deletions
|
@ -805,7 +805,13 @@ LocalNoInline(void addErrorTrace(Error & e, const Pos & pos, const char * s, con
|
|||
|
||||
void Value::mkString(std::string_view s)
|
||||
{
|
||||
mkString(dupStringWithLen(s.data(), s.size()));
|
||||
if (s.size() == 0) {
|
||||
// s.data() may not be valid and we don't need to allocate.
|
||||
mkString("");
|
||||
}
|
||||
else {
|
||||
mkString(dupStringWithLen(s.data(), s.size()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue