material-components-android
material-components-android copied to clipboard
[RangeSlider] Crash occurs when assigning a large value to `valueTo`.
Description: Crash occurs when assigning a large value to valueTo.
To reproduce, set the values as follows.
-
valueFrom: 1000.0 -
valueTo: 258896000.0 -
stepSize: 1000.0
Expected behavior:
Source code: The cause is the floating point rounding error.
private boolean valueLandsOnTick(float value) {
// Check that the value is a multiple of stepSize given the offset of valueFrom.
return isMultipleOfStepSize(value - valueFrom);
}
Minimal sample app repro: https://github.com/Park-SM/material-components-android/tree/reproduced_branch
Android API version: Android API 33
Material Library version: 1.9.0
Device: Galaxy Z Flip4
also see https://github.com/material-components/material-components-android/pull/3979
Fixed in ac77b4cfb5ac15b37240fd455233cbca237e103f