diff --git a/src/util/AllocatedString.hxx b/src/util/AllocatedString.hxx
index 19f17ee0e..2ca1218c9 100644
--- a/src/util/AllocatedString.hxx
+++ b/src/util/AllocatedString.hxx
@@ -125,7 +125,9 @@ public:
 	}
 
 	operator string_view() const noexcept {
-		return value;
+		return value != nullptr
+			? string_view(value)
+			: string_view();
 	}
 
 	constexpr const_pointer c_str() const noexcept {