Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Avoid NullReferenceException for MaterialActivityIndicatorRenderer #10747

Merged
merged 1 commit into from
Jul 2, 2020

Conversation

tomeverin
Copy link
Contributor

@tomeverin tomeverin commented May 18, 2020

Under some conditions, possibly related to ActivityIndicator visibility, Control may be null at time of call to LayoutSubviews(). This caused crash due to NullReferenceException. This null check avoids that problem.

Note: this is the second PR for the same; was accidentally merging from master to 4.6.0 on the first one.

Description of Change

Null check for Control in Xamarin.Forms.Material.iOS.MaterialActivityIndicatorRenderer.LayoutSubviews()

Issues Resolved

I noticed that at times I was seeing crashes due to NullReferenceException following Shell's GoToAsync method. On further investigation it was due to attempted access on a null Control. This null check solved the problem.

API Changes

None.

Platforms Affected

  • iOS only

Behavioral/Visual Changes

Resolution of NullReferenceException crashes

Before/After Screenshots

Not applicable

Testing Procedure

I wasn't able to come up with a simple repro, however the issue was reliably reproducible in my production app. It occurred on returning to a ShellItem via GoToAsync for a second time. May have something to do with ActivityIndicator visibility.

PR Checklist

  • Targets the correct branch
  • Tests are passing (or failures are unrelated)

Under some conditions, possibly related to ActivityIndicator visibility, Control may be null at time of call to LayoutSubviews(). This caused crash due to NullReferenceException. This null check avoids that problem.
@samhouts samhouts added i/high Completely doesn't work, crashes, or is unusably slow, has no obvious workaround; occurs less often t/bug 🐛 a/activityindicator labels Jun 8, 2020
@samhouts samhouts added this to In Review in v4.6.0 Jun 20, 2020
@samhouts samhouts changed the base branch from 4.6.0 to 4.7.0 June 25, 2020 22:24
@samhouts samhouts removed this from In Review in v4.6.0 Jun 25, 2020
@samhouts samhouts added this to In Review in 4.7.0 Jun 25, 2020
@tomeverin
Copy link
Contributor Author

Ping @PureWeen 🙏
Currently needing to build my own Visual.Material local nuget at each release, with the null check, just to avoid the crashes

@rmarinho rmarinho merged commit dcc1117 into xamarin:4.7.0 Jul 2, 2020
4.7.0 automation moved this from In Review to Done Jul 2, 2020
@samhouts samhouts added this to Done in Sprint 172 Jul 2, 2020
@samhouts samhouts modified the milestones: 4.8.0, 4.7.0 Jul 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a/activityindicator a/visual i/high Completely doesn't work, crashes, or is unusably slow, has no obvious workaround; occurs less often p/iOS 🍎 t/bug 🐛
Projects
No open projects
4.7.0
  
Done
Sprint 172
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

4 participants