From 1c7c2026dbd449f993fe41b7c7f8d8079e1e1545 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 11 Mar 2025 09:23:32 +0100 Subject: [PATCH] config/Path: check for empty XDG variables --- src/config/Path.cxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/config/Path.cxx b/src/config/Path.cxx index 1687480ab..f3b4d04a1 100644 --- a/src/config/Path.cxx +++ b/src/config/Path.cxx @@ -114,6 +114,9 @@ ParsePath(std::string_view path) const auto [name, rest] = Split(path, '/'); const auto value = GetVariable(name); + if (value.IsNull()) + throw FmtRuntimeError("No value for variable: {:?}", name); + return value / AllocatedPath::FromUTF8Throw(rest); } else if (!PathTraitsUTF8::IsAbsolute(path)) { throw FmtRuntimeError("not an absolute path: {:?}", path);