summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2017-10-07 12:10:41 +0200
committerLars-Dominik Braun <lars@6xq.net>2017-10-07 12:10:41 +0200
commit60bf2f547e6a1d853b481fc7e105a98c3a6d163f (patch)
treeacb5a61e47ee669734532bc85bb3120dba29140a
parent2db7a3cca6ec47c00e9691bf3f8f588db0332a52 (diff)
downloadpianobar-60bf2f547e6a1d853b481fc7e105a98c3a6d163f.tar.gz
pianobar-60bf2f547e6a1d853b481fc7e105a98c3a6d163f.tar.bz2
pianobar-60bf2f547e6a1d853b481fc7e105a98c3a6d163f.zip
Fix logic for marking station (deleted)
For songs with no station associated (NULL) “(deleted)” was shown unconditionally. Hide it. Fixes commit 4dfca5b56b441faf4938b6c8e97585f68e468039.
-rw-r--r--src/ui.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/ui.c b/src/ui.c
index 0d62e6b..0512f36 100644
--- a/src/ui.c
+++ b/src/ui.c
@@ -767,16 +767,15 @@ size_t BarUiListSongs (const BarApp_t * const app,
if (filter == NULL ||
(filter != NULL && (BarStrCaseStr (song->artist, filter) != NULL ||
BarStrCaseStr (song->title, filter) != NULL))) {
- const char * const empty = "";
- const char *stationName = "(deleted)";
+ const char * const deleted = "(deleted)", * const empty = "";
+ const char *stationName = empty;
+
const PianoStation_t * const station =
PianoFindStationById (app->ph.stations, song->stationId);
- if (station != NULL) {
- if (station != app->curStation) {
- stationName = station->name;
- } else {
- stationName = empty;
- }
+ if (station != NULL && station != app->curStation) {
+ stationName = station->name;
+ } else if (station == NULL && song->stationId != NULL) {
+ stationName = deleted;
}
char outstr[512], digits[8], duration[8] = "??:??";