Merge pull request #1314 from Scrumplex/fix-negative-mpd-vol

Ensure MPD volume is not negative
This commit is contained in:
Alex 2021-11-12 09:04:21 +01:00 committed by GitHub
commit 9fda6695ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -131,6 +131,9 @@ void waybar::modules::MPD::setLabel() {
date = getTag(MPD_TAG_DATE); date = getTag(MPD_TAG_DATE);
song_pos = mpd_status_get_song_pos(status_.get()); song_pos = mpd_status_get_song_pos(status_.get());
volume = mpd_status_get_volume(status_.get()); volume = mpd_status_get_volume(status_.get());
if (volume < 0) {
volume = 0;
}
queue_length = mpd_status_get_queue_length(status_.get()); queue_length = mpd_status_get_queue_length(status_.get());
elapsedTime = std::chrono::seconds(mpd_status_get_elapsed_time(status_.get())); elapsedTime = std::chrono::seconds(mpd_status_get_elapsed_time(status_.get()));
totalTime = std::chrono::seconds(mpd_status_get_total_time(status_.get())); totalTime = std::chrono::seconds(mpd_status_get_total_time(status_.get()));