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

#2922 RotatorTile _nextElement null exception #2969

Merged
merged 7 commits into from Sep 11, 2019
Merged

#2922 RotatorTile _nextElement null exception #2969

merged 7 commits into from Sep 11, 2019

Conversation

SoundersFan
Copy link

Guard against dereferencing null _nextElement

Issue: #2922

PR Type

What kind of change does this PR introduce?

  • Bugfix

What is the current behavior?

When RotatorTile is initially Collapsed the OnApplyTemplate() method is not called before the control starts it's background timer to auto-advance the items. In advancing the _nextElement is dereferenced but since OnApplyTemplate has not run, it is still null and, kaboom.

What is the new behavior?

The null reference is avoided and no kaboom

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tested code with current supported SDKs
  • Pull Request has been submitted to the documentation repository instructions. Link:
  • Sample in sample app has been added / updated (for bug fixes / features)
  • Tests for the changes have been added (for bug fixes / features) (if applicable)
  • Header has been added to all new source files (run build/UpdateHeaders.bat)
  • Contains NO breaking changes

Other information

Guard against dereferencing null _nextElement
@dnfclas
Copy link

dnfclas commented Jul 17, 2019

CLA assistant check
All CLA requirements met.

@dnfclas
Copy link

dnfclas commented Jul 17, 2019

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.

❌ SoundersFan sign now
You have signed the CLA already but the status is still pending? Let us recheck it.

Fix StyleCop error
@SoundersFan SoundersFan changed the title #2922 #2922 RotatorTile _nextElement null exception Jul 18, 2019
@michael-hawker
Copy link
Member

Thanks @SoundersFan, it looks like we try and start the timer in both the OnApplyTemplate and when the control has Loaded. However, we should probably not start the timer on Load if the control is collapsed? I'm wondering if trying to mitigate the scenario where this occurs would be better than trying to just add null checks everywhere?

@michael-hawker
Copy link
Member

We discussed, we can address the timer question separately. Will test quick later so we can merge this.

Copy link
Member

@michael-hawker michael-hawker left a comment

Choose a reason for hiding this comment

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

Thanks @SoundersFan, tested it out and it looks good!

@Kyaa-dost
Copy link
Contributor

Tested on my end and seems to be performing as expected. All clear!

@Kyaa-dost Kyaa-dost added the bug 🐛 An unexpected issue that highlights incorrect behavior label Sep 10, 2019
@azchohfi azchohfi merged commit 6fab33d into CommunityToolkit:master Sep 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 An unexpected issue that highlights incorrect behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants