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

capabilities: avoid NRE when ValueOrBinding<int>? is set to null #1864

Merged
merged 1 commit into from
Oct 4, 2024

Conversation

exyi
Copy link
Member

@exyi exyi commented Sep 20, 2024

Nullable ValueOrBinding, for example ValueOrBinding? semantially means that the property is not set.
If the property is set to null, we would like to return null inside of the ValueOrBinding.
However, that is not possible if T is non-nullable value type, so either have to throw, or return an "outer" null. This patch changes the behavior to return null instead of failing. Users are unlikely to care about "not set" and "set to null", and throwing the exception creates unnecessary friction.

Nullable ValueOrBinding, for example ValueOrBinding<int>?
semantially means that the property is not set.
If the property is set to null, we would like to return null inside
of the ValueOrBinding.
However, that is not possible if T is non-nullable value type, so
either have to throw, or return an "outer" null. This patch
changes the behavior to return null instead of failing. Users
are unlikely to care about "not set" and "set to null", and
throwing the exception creates unnecessary friction.
@tomasherceg tomasherceg merged commit 0df5117 into main Oct 4, 2024
14 of 15 checks passed
@tomasherceg tomasherceg deleted the fix-capabilities-nullableVOB branch October 4, 2024 12:42
@exyi exyi added this to the Version 4.3 milestone Oct 10, 2024
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