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

[Treeview] Fix two potential null reference issues #832

Merged
merged 1 commit into from
Mar 14, 2021
Merged

[Treeview] Fix two potential null reference issues #832

merged 1 commit into from
Mar 14, 2021

Conversation

YannickRe
Copy link
Contributor

Q A
Bug fix? [X]

What's in this Pull Request?

A fix for two potential null reference issues:

  • when expandToSelected == true but defaultSelectedKeys == null. This combination of properties does not make much sense : if you want expandToSelected you NEED values in defaultSelectedKeys, but defaultSelectedKeys is not required thus this combination can happen and it breaks the control.
  • when expandToSelected == true but somewhere in the tree there is a treeItem.children == null. You should set children == null when you don't want the expand arrow to show, but it breaks in combination with expandToSelection == true.

This PR fixes both issues.

- when expandToSelected == true but nothing has been passed to defaultSelectedKeys (it doesn't make much sense tocombine both properties like this BUT defaultSelectedKeys is not required thus this case should be properly handled)
- when expandToSelected == true but somewhere in the tree, treeItem.children == null (which is normal when there aren't any children of this specific item)
@AJIXuMuK AJIXuMuK merged commit 5735056 into pnp:dev Mar 14, 2021
@AJIXuMuK
Copy link
Collaborator

Thank you @YannickRe for the PR!

It has been merged and will be included in the next release.

@AJIXuMuK AJIXuMuK added this to the 2.6.0 milestone Mar 14, 2021
@estruyf estruyf mentioned this pull request Mar 22, 2021
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