Player: Prevent overflows in vol_up() and vol_down().
This commit is contained in:
parent
547080acf5
commit
0dd5937707
@ -464,14 +464,14 @@ void Player::set_volume(uint8_t vol, bool save) {
|
||||
|
||||
void Player::vol_up() {
|
||||
if (!is_playing()) return;
|
||||
uint8_t vol = _volume + VOLUME_STEP;
|
||||
uint16_t vol = _volume + VOLUME_STEP;
|
||||
if (vol > VOLUME_MAX) vol=VOLUME_MAX;
|
||||
set_volume(vol);
|
||||
}
|
||||
|
||||
void Player::vol_down() {
|
||||
if (!is_playing()) return;
|
||||
uint8_t vol = _volume - VOLUME_STEP;
|
||||
int16_t vol = _volume - VOLUME_STEP;
|
||||
if (vol < VOLUME_MIN) vol=VOLUME_MIN;
|
||||
set_volume(vol);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user