Skip to content

Unexpected behavior when setting progress outside set min (0) and max #17

@josefdlange

Description

@josefdlange

I ran into a crash that was a stupid error on my part, but perhaps could be handled more gracefully by the library or at least be well-documented. If I set a progress value that is outside the range of 0 to max, I get a crash.

I could see perhaps a modification to this library that, when receiving a progress value, floors or ceilings it to the acceptable range. For example, if a progress of 6 is set on a pie view with a max of 4, the effective progress value would become 4. Likewise for negative numbers, if progress is set as -3, then the effective progress for display becomes 0.

If you'd rather not sanitize inputs in that way, I'd suggest either a note about it in the documentation and/or a RuntimeException subclass that is thrown when this occurs, and a throws declaration on the setProgress and setMax signatures.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions