From 5519e5c9bc6b5a35f3707e1687a4ed2548d2dacb Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Tue, 26 May 2009 22:09:13 +0200 Subject: [PATCH] if volume < 0, display 'n/a' instead of '-1%' --- src/status.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/status.cpp b/src/status.cpp index 5916477c..30afe20e 100644 --- a/src/status.cpp +++ b/src/status.cpp @@ -502,8 +502,14 @@ void NcmpcppStatusChanged(Connection *Mpd, StatusChanges changed, void *) if (changed.Volume && Config.header_visibility) { VolumeState = " Volume: "; - VolumeState += IntoStr(Mpd->GetVolume()); - VolumeState += "%"; + int volume = Mpd->GetVolume(); + if (volume < 0) + VolumeState += "n/a"; + else + { + VolumeState += IntoStr(volume); + VolumeState += "%"; + } wHeader->SetColor(Config.volume_color); *wHeader << XY(wHeader->GetWidth()-VolumeState.length(), 0) << VolumeState; wHeader->SetColor(Config.header_color);