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

[iOS] Fix crash on iOS LabelRenderer UpdateTextColor #14982

Merged
merged 1 commit into from
Dec 20, 2021

Conversation

fedemkr
Copy link
Contributor

@fedemkr fedemkr commented Dec 14, 2021

Description of Change

When the label is TextType=Html and the html is big, when you send the app to background change the theme, go back then the app and close the current page it has high changes to crash because the Element is null. So this fixes it by checking that before updating the color.

Issues Resolved

  • I couldn't find an issue to link to this, should I create it?

API Changes

None

Platforms Affected

  • iOS

Behavioral/Visual Changes

None

Before/After Screenshots

Not applicable

Testing Procedure

  • Create a view that can be open and close from another part
  • On that view set a Label with TextType HTML and bind a large HTML (In my particular case, I had one that was like 150 chars styled with different colors depending on the char type, i.e. number, special, alphabet, etc)
  • Open the app and open that view
  • Put the app on background
  • Change the light/dark theme
  • Open the app again and without leaving the HTML to load properly (sometimes it takes time to apply the correct format) close the view (back button or in-app cancel/close view)
  • The app crashes

PR Checklist

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

When the label is `TextType=Html` and the html is big, when you send the app to background change the theme and go back then the app has high changes to crash because the `Element` is `null`. So this fixes it by checking that before updating the color.
@jfversluis
Copy link
Member

Hey @fedemkr thanks so much for your contribution! Don't worry about the issue, I will check it out from the info you gave here :)

@jfversluis
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jfversluis
Copy link
Member

@fedemkr there is a NuGet now available for this, would you be able to grab the NuGet as described here and me know if this actually fixes the issue you meant to fix?

@jfversluis
Copy link
Member

Going to merge this for now as I don't see any way this could cause too much trouble. If you still get to test it, please let me know the results!

@jfversluis jfversluis merged commit 0eb3194 into xamarin:5.0.0 Dec 20, 2021
5.0.0 SR9 (Planning) - Target Date Jan. 19th automation moved this from Issues in Progress to Done Dec 20, 2021
@fedemkr
Copy link
Contributor Author

fedemkr commented Dec 20, 2021

Just tested the Nuget PR preview and I can confirm that the fix works. Thanks @jfversluis 😄

@fedemkr fedemkr deleted the patch-2 branch December 20, 2021 16:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants