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

[MacCatalyst] [iOS] Fix IconTintColorBehavior ImageButton Disappearing and Crash On Source Change #2317

Merged
merged 1 commit into from
Nov 5, 2024

Conversation

Bensley96
Copy link
Contributor

Description of Change

Fixes issues when the image source is changed on a ButtonImage in MacCatalyst where IconTintBehavior would throw a null reference on button.CurrentImage due to a race condition.

Linked Issues

#2313

  • Fixes #

PR Checklist

Additional information

This checks if the CurrentImage is null before proceeding. MacCatalyst and iOS has been tested, both found to have the bug and are fixed with this patch.

Fixes issues when the image is changed on MacCatalyst where IconTintBehavior would throw a null reference on button.currentimage due to a race condition.

This best case would cause the image to not display and worse case cause a complete crash of the app.

This checks if the currentimage is null before proceeding. 

With this check added there is no longer a crash and the image button updates with the new image with the correct tint applied
@Bensley96
Copy link
Contributor Author

@dotnet-policy-service agree

@brminnick brminnick enabled auto-merge (squash) November 5, 2024 16:06
@brminnick brminnick merged commit 309c27a into CommunityToolkit:main Nov 5, 2024
9 checks passed
@Bensley96 Bensley96 deleted the patch-1 branch November 6, 2024 00:31
@github-actions github-actions bot locked and limited conversation to collaborators Nov 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants