Fix crash when setting sleep timer to zero

This commit is contained in:
ByteHamster 2021-07-30 22:23:31 +02:00
parent 666a11f3a9
commit 55b559ac2b

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) {