glide
glide copied to clipboard
Fix NaN exception when rounding dimensions
Description
Fixes this issue: https://github.com/bumptech/glide/issues/5356
This change:
- Checks if the scaled width/height values are finite (not NaN or infinite) using isFinite()
- If the value is finite, rounds it to an integer as before
- If the value is not finite (NaN or infinite), falls back to using the constraints' minimum dimensions This prevents any potential IllegalArgumentException that could be thrown when trying to round NaN or infinite values, making the code more robust.
Motivation and Context
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).
View this failed invocation of the CLA check for more information.
For the most up to date status, view the checks section at the bottom of the pull request.
Can you add tests?
I didn't notice this (or the several bugs filed starting with https://github.com/bumptech/glide/issues/5256), but I think https://github.com/bumptech/glide/pull/5499 subsumes this?