From 1cd5c5ec77ea43088982a439b58499be87c62087 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Sat, 7 Mar 2015 16:01:26 +0100 Subject: Fix upcoming songs assertion failure This should not be an assertion, it is expected to happen. Test with `echo -e "s0\nu" > ctl`. Fixes #509. --- src/libpiano/piano.h | 2 +- src/ui_act.c | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/libpiano/piano.h b/src/libpiano/piano.h index 58eb7ef..28a2b45 100644 --- a/src/libpiano/piano.h +++ b/src/libpiano/piano.h @@ -317,7 +317,7 @@ void *PianoListDelete (PianoListHead_t * const l, PianoListHead_t * const e) __attribute__ ((warn_unused_result)); #define PianoListDeleteP(l,e) PianoListDelete(((l) == NULL) ? NULL : &(l)->head, \ &(e)->head) -#define PianoListNextP(e) ((void *) (e)->head.next) +#define PianoListNextP(e) ((e) == NULL ? NULL : (void *) (e)->head.next) void *PianoListPrepend (PianoListHead_t * const l, PianoListHead_t * const e) __attribute__ ((warn_unused_result)); #define PianoListPrependP(l,e) PianoListPrepend (((l) == NULL) ? NULL : &(l)->head, \ diff --git a/src/ui_act.c b/src/ui_act.c index 7515396..c39f98b 100644 --- a/src/ui_act.c +++ b/src/ui_act.c @@ -496,9 +496,7 @@ BarUiActCallback(BarUiActTempBanSong) { /* print upcoming songs */ BarUiActCallback(BarUiActPrintUpcoming) { - assert (selSong != NULL); - - PianoSong_t *nextSong = PianoListNextP (selSong); + PianoSong_t * const nextSong = PianoListNextP (selSong); if (nextSong != NULL) { BarUiListSongs (&app->settings, nextSong, NULL); } else { -- cgit v1.2.3