From 5feece0be8491287625b105af35d0091cbb05aa6 Mon Sep 17 00:00:00 2001 From: Gregory Petrosyan Date: Tue, 13 Nov 2012 22:36:26 +0400 Subject: [PATCH] lib: fix segfault caused by player-prev On Tue, Nov 13, 2012 at 4:48 PM, Philipp Hartwig wrote: > with git HEAD and an empty ~/.cmus, the following steps produce a segfault for > me: > > First > set repeat=true > set aaa_mode=album > > Then add some album, play the first track and execute player-prev. The track > selection should wrap around to the last track of the album, but instead cmus > crashes. Fix it by replacing bad line of code with the obviously correct one. Reported-by: Philipp Hartwig Signed-off-by: Gregory Petrosyan --- lib.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lib.c b/lib.c index f92451e..46ffe64 100644 --- a/lib.c +++ b/lib.c @@ -271,7 +271,7 @@ static struct tree_track *normal_get_prev(void) if (!repeat) return NULL; /* last track of the album */ - return to_tree_track(rb_prev(&CUR_ALBUM->tree_node)); + return album_last_track(CUR_ALBUM); } /* not first album of the artist? */ -- 1.7.3.3