diff options
author | Lars-Dominik Braun <lars@6xq.net> | 2017-10-07 12:10:41 +0200 |
---|---|---|
committer | Michał Cichoń <michcic@gmail.com> | 2018-10-30 12:05:37 +0100 |
commit | 02baa2f39ac59a044610ecfada313f1b472f991f (patch) | |
tree | d7235ce80d71ad60a7ce861b0a950cf29cce2282 /src | |
parent | eebc4b34e9f8b23f384205543e94d1278b6e63d5 (diff) | |
download | pianobar-windows-02baa2f39ac59a044610ecfada313f1b472f991f.tar.gz pianobar-windows-02baa2f39ac59a044610ecfada313f1b472f991f.tar.bz2 pianobar-windows-02baa2f39ac59a044610ecfada313f1b472f991f.zip |
Fix logic for marking station (deleted)
For songs with no station associated (NULL) “(deleted)” was shown
unconditionally. Hide it. Fixes commit
4dfca5b56b441faf4938b6c8e97585f68e468039.
Diffstat (limited to 'src')
-rw-r--r-- | src/ui.c | 15 |
1 files changed, 7 insertions, 8 deletions
@@ -671,16 +671,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] = "??:??"; |