Merge pull request #5315 from ByteHamster/fix-sleeptimer-0

Fix crash when setting sleep timer to zero
This commit is contained in:
ByteHamster 2021-07-30 23:20:53 +02:00 committed by GitHub
commit 05e6119f03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -153,10 +153,13 @@ public class SleepTimerDialog extends DialogFragment {
return;
}
try {
long time = Long.parseLong(etxtTime.getText().toString());
if (time == 0) {
throw new NumberFormatException("Timer must not be zero");
}
SleepTimerPreferences.setLastTimer(etxtTime.getText().toString(), spTimeUnit.getSelectedItemPosition());
long time = SleepTimerPreferences.timerMillis();
if (controller != null) {
controller.setSleepTimer(time);
controller.setSleepTimer(SleepTimerPreferences.timerMillis());
}
closeKeyboard(content);
} catch (NumberFormatException e) {