mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-28 16:00:31 +05:30
Merge pull request #6669 from Bnyro/master
fix: don't allow empty input in EditNumberPreference
This commit is contained in:
commit
88d92bda74
@ -89,7 +89,7 @@ abstract class BasePreferenceFragment : PreferenceFragmentCompat() {
|
|||||||
.setView(binding.root)
|
.setView(binding.root)
|
||||||
.setPositiveButton(android.R.string.ok) { _, _ ->
|
.setPositiveButton(android.R.string.ok) { _, _ ->
|
||||||
val newValue = binding.input.text.toString()
|
val newValue = binding.input.text.toString()
|
||||||
if (preference is EditNumberPreference && newValue.any { !it.isDigit() }) {
|
if (preference is EditNumberPreference && newValue.toIntOrNull() == null) {
|
||||||
Toast.makeText(context, R.string.invalid_input, Toast.LENGTH_LONG).show()
|
Toast.makeText(context, R.string.invalid_input, Toast.LENGTH_LONG).show()
|
||||||
return@setPositiveButton
|
return@setPositiveButton
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user