Skip to content

Commit

Permalink
fix: avoid NumberFormatException on String > Integer.MAX_INT
Browse files Browse the repository at this point in the history
  • Loading branch information
mikehardy authored and BrayanDSO committed Nov 26, 2024
1 parent 6b5e538 commit 0fe5e9b
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ constructor(
* @param input User input in text editor.
* @return The input value within acceptable range.
*/
private fun getValidatedRangeFromString(input: String): Int {
fun getValidatedRangeFromString(input: String): Int {
return if (input.isEmpty()) {
min
} else {
Expand Down Expand Up @@ -185,7 +185,7 @@ constructor(
if (!positiveResult || editText.text.isEmpty()) {
return
}
val newValue = editText.text.toString().toInt()
val newValue = numberRangePreference.getValidatedRangeFromString(editText.text.toString())
if (numberRangePreference.callChangeListener(newValue)) {
numberRangePreference.setValue(newValue)
}
Expand Down

0 comments on commit 0fe5e9b

Please sign in to comment.