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

Prevent crashes on ImplicitAnimation page by checking for NaN #476

Merged
merged 2 commits into from
Jul 2, 2020

Conversation

marcelwgn
Copy link
Collaborator

Description

The page crashed when setting the opacity and other values in samples on the page since a cleared NumberBox will report double.NaN as its value which is not a valid value for those cases. This is now fixed by wrapping the "get call" and setting the NumberBox value to 0 if its NaN.

Motivation and Context

Fixes #475

How Has This Been Tested?

Tested manually by clearing the NumberBox values and clicking the "set value buttons" on the samples.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

@@ -137,6 +137,15 @@ private void BackgroundButton_Click(object sender, RoutedEventArgs e)
}
}

private double EnsureValueIsNumber(NumberBox numberBox)
Copy link
Contributor

Choose a reason for hiding this comment

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

Could this return a float instead? Then we wouldn't need to cast above.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point, fixed now.

@stmoy stmoy merged commit 0e9d253 into microsoft:master Jul 2, 2020
bpulliam pushed a commit that referenced this pull request Feb 1, 2022
* Prevent crashes on ImplicitAnimation page by checking for NaN

* Remove casts
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.

[CRASH] Motion > Implicit Transition > Empty Opacity field
2 participants