diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index b954e7bd9..7f82aa5f4 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -842,7 +842,14 @@ void Value::mkStringMove(const char * s, const PathSet & context) void Value::mkPath(std::string_view s) { - mkPath(dupStringWithLen(s.data(), s.size())); + if (s.size() == 0) { + // Pathological, but better than crashing in dupStringWithLen, as + // s.data() may be null. + mkPath(""); + } + else { + mkPath(dupStringWithLen(s.data(), s.size())); + } }