diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2017-12-15 21:46:30 -0500 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2017-12-15 22:39:46 -0500 |
commit | 02d20ebc25e90914528c6af712f27c5424b863a4 (patch) | |
tree | 498d3e1972688d6cc0cba0190bd1dd1f45dc2d68 | |
parent | c8564f1ca8287eba9220df191d13c949bb49c8ce (diff) | |
download | rockbox-02d20ebc25e90914528c6af712f27c5424b863a4.tar.gz 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
-rw-r--r-- | apps/playback.c | 28 |
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) | |||
611 | return; | 611 | return; |
612 | } | 612 | } |
613 | 613 | ||
614 | /* If this one is the current track; new current track is next one, | ||
615 | if any, else, the previous */ | ||
616 | if (hid == track_list.current_hid) | ||
617 | track_list.current_hid = next_hid > 0 ? next_hid : prev_hid; | ||
618 | |||
619 | /* Fixup list links */ | ||
614 | if (prev_tbip) | 620 | if (prev_tbip) |
615 | { | ||
616 | prev_tbip->link[1] = next_hid; | 621 | prev_tbip->link[1] = next_hid; |
617 | } | ||
618 | else | 622 | else |
619 | { | ||
620 | /* Was the first track; new first track is next one */ | ||
621 | track_list.first_hid = next_hid; | 623 | track_list.first_hid = next_hid; |
622 | 624 | ||
623 | if (hid == track_list.current_hid) | ||
624 | { | ||
625 | /* Was the current track; new current track is next one */ | ||
626 | track_list.current_hid = next_hid; | ||
627 | } | ||
628 | } | ||
629 | |||
630 | if (next_tbip) | 625 | if (next_tbip) |
631 | { | ||
632 | next_tbip->link[0] = prev_hid; | 626 | next_tbip->link[0] = prev_hid; |
633 | } | ||
634 | else | 627 | else |
635 | { | ||
636 | /* Was the last track; new last track is previous one */ | ||
637 | track_list.last_hid = prev_hid; | 628 | track_list.last_hid = prev_hid; |
638 | 629 | ||
639 | if (hid == track_list.current_hid) | ||
640 | { | ||
641 | /* Was the current track; new current track is previous one */ | ||
642 | track_list.current_hid = prev_hid; | ||
643 | } | ||
644 | } | ||
645 | |||
646 | track_list.count--; | 630 | track_list.count--; |
647 | } | 631 | } |
648 | 632 | ||