Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Sep 9, 2024

Conversation

Migaroez
Copy link
Contributor

@Migaroez Migaroez commented Sep 9, 2024

Prerequisites

  • I have added steps to test this contribution in the description below

Fixes #16753

Bug summary

CacheValues.For accepts nullable string culture and segment parameters but only performs an empty string check on them, not a null or empty check. This results in an exception because it then attempts to create a CompositeStringStringKey with the culture and segment but this object doesn't accept null arguments.

Description

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

Testing

Make sure (invariant) (published) content still behaves correctly in multi culture/segment scenarios.

Copy link
Contributor

@nikolajlauridsen nikolajlauridsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, tests good 👍

@nikolajlauridsen nikolajlauridsen merged commit a74d963 into v13/dev Sep 9, 2024
16 checks passed
@nikolajlauridsen nikolajlauridsen deleted the v13/fix/cacheValues-for-null branch September 9, 2024 16:13
Migaroez added a commit that referenced this pull request Sep 10, 2024
…positeStringStringKey (#17024)

* Fix null ref exeption based on IPropertyValue.Culture documentation

* Clarify comment
madsoulswe pushed a commit to madsoulswe/Umbraco-CMS that referenced this pull request Sep 18, 2024
…positeStringStringKey (umbraco#17024)

* Fix null ref exeption based on IPropertyValue.Culture documentation

* Clarify comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants