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

Avoid NullReferenceException on TruncatedCollection<T> #2200

Merged
merged 5 commits into from Jul 10, 2020

Conversation

bdebaere
Copy link
Contributor

@bdebaere bdebaere commented Jun 17, 2020

Issues

This pull request fixes an issue where a NullReferenceException is thrown when CollectionExpandedProperty.GetValue is called with a Collection which is null. This is due to the constructor of TruncatedCollection having : base(source.Take(checked(pageSize + 1))), and IEnumerable.Take cannot deal with a null value.

Description

Adds a null check before instantiating a TruncatedCollection in CollectionExpandedProperty.GetValue.

Checklist (Uncheck if it is not completed)

  • Test cases added
  • Build and test with one-click build and test script passed

Copy link
Member

@mikepizzo mikepizzo left a comment

Choose a reason for hiding this comment

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

:shipit:

@mikepizzo mikepizzo merged commit 4846b3d into OData:master Jul 10, 2020
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.

None yet

2 participants