From 2f56ee9d0ffecbae531dd198cfe51a334e05dbe4 Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Tue, 17 Jan 2006 14:15:47 +0000 Subject: [PATCH] Proper fix for the playlist viewer crash git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8359 a1c6a512-1295-4272-9138-f99709370657 --- apps/playlist_viewer.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/playlist_viewer.c b/apps/playlist_viewer.c index 9ce471877e..6dc168d49a 100644 --- a/apps/playlist_viewer.c +++ b/apps/playlist_viewer.c @@ -37,6 +37,7 @@ #include "talk.h" #include "misc.h" #include "action.h" +#include "debug.h" #include "lang.h" @@ -183,8 +184,9 @@ void playlist_buffer_load_entries_screen(struct playlist_buffer * pb, if(direction==FORWARD) { int min_start=viewer.selected_track-2*screens[0].nb_lines; - if(min_start<0) - min_start=MAX_PLAYLIST_ENTRIES+min_start; + while(min_start<0) + min_start+=viewer.num_tracks; + min_start %= viewer.num_tracks; playlist_buffer_load_entries(pb, min_start, FORWARD); } else