mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-12 21:30:30 +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)
|
||||
.setPositiveButton(android.R.string.ok) { _, _ ->
|
||||
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()
|
||||
return@setPositiveButton
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user