Fix null reference exception in CacheValues.For when building the CompositeStringStringKey (#17024)

* Fix null ref exeption based on IPropertyValue.Culture documentation

* Clarify comment
This commit is contained in:
Sven Geusens
2024-09-09 18:13:14 +02:00
committed by GitHub
parent 5fe18bb78c
commit a74d963cfa

View File

@@ -371,6 +371,12 @@ internal class Property : PublishedPropertyBase
public CacheValue For(string? culture, string? segment)
{
// As noted on IPropertyValue, null value means invariant
// But as we need an actual string value to build a CompositeStringStringKey
// We need to convert null to empty
culture ??= string.Empty;
segment ??= string.Empty;
if (culture == string.Empty && segment == string.Empty)
{
return this;