summaryrefslogtreecommitdiffstats
path: root/apps/playback.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2017-12-15 21:46:30 -0500
committerMichael Sevakis <jethead71@rockbox.org>2017-12-15 22:39:46 -0500
commit02d20ebc25e90914528c6af712f27c5424b863a4 (patch)
tree498d3e1972688d6cc0cba0190bd1dd1f45dc2d68 /apps/playback.c
parentc8564f1ca8287eba9220df191d13c949bb49c8ce (diff)
downloadrockbox-02d20ebc25e90914528c6af712f27c5424b863a4.tar.gz
rockbox-02d20ebc25e90914528c6af712f27c5424b863a4.tar.bz2
rockbox-02d20ebc25e90914528c6af712f27c5424b863a4.zip
Fix big WTF when closing the current track.
It must be set to something else valid (unless it's the only one left) when closing it, IN ALL CASES, not just if it's first or last. Don't know what was in my head. Hopefully takes care of a reported issue. Even if it's not causing any issues, it was still incorrect. Change-Id: I594af8b35d774ec222dadce80dfa8b95138f037e
Diffstat (limited to 'apps/playback.c')
-rw-r--r--apps/playback.c28
1 files changed, 6 insertions, 22 deletions
diff --git a/apps/playback.c b/apps/playback.c
index 25aa1948d6..8b607f30f0 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -611,38 +611,22 @@ static void track_list_free_buf_info(struct track_buf_info *tbip)
return;
}
+ /* If this one is the current track; new current track is next one,
+ if any, else, the previous */
+ if (hid == track_list.current_hid)
+ track_list.current_hid = next_hid > 0 ? next_hid : prev_hid;
+
+ /* Fixup list links */
if (prev_tbip)
- {
prev_tbip->link[1] = next_hid;
- }
else
- {
- /* Was the first track; new first track is next one */
track_list.first_hid = next_hid;
- if (hid == track_list.current_hid)
- {
- /* Was the current track; new current track is next one */
- track_list.current_hid = next_hid;
- }
- }
-
if (next_tbip)
- {
next_tbip->link[0] = prev_hid;
- }
else
- {
- /* Was the last track; new last track is previous one */
track_list.last_hid = prev_hid;
- if (hid == track_list.current_hid)
- {
- /* Was the current track; new current track is previous one */
- track_list.current_hid = prev_hid;
- }
- }
-
track_list.count--;
}