Fix FS#6215 (player crashes after trying to resume deleted music file). As mentioned in the lastest comment, the problem was in trying to resume at an offset larger than the size of the file following the one that was deleted. This revealed a crash in the buffering code, which gets a fix, but we also need to intervene earlier in the track loading so that the track that gets played will be from its start.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16028 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Nicolas Pennequin 2008-01-08 23:48:51 +00:00
parent 5fd859b68a
commit 659fe5a35b
2 changed files with 6 additions and 0 deletions

View file

@ -880,6 +880,9 @@ int bufopen(const char *file, size_t offset, enum data_type type)
size_t size = filesize(fd); size_t size = filesize(fd);
bool can_wrap = type==TYPE_PACKET_AUDIO || type==TYPE_CODEC; bool can_wrap = type==TYPE_PACKET_AUDIO || type==TYPE_CODEC;
if (offset > size)
offset = 0;
struct memory_handle *h = add_handle(size-offset, can_wrap, false); struct memory_handle *h = add_handle(size-offset, can_wrap, false);
if (!h) if (!h)
{ {

View file

@ -1683,6 +1683,9 @@ static bool audio_load_track(int offset, bool start_play)
tracks[track_widx].filesize = filesize(fd); tracks[track_widx].filesize = filesize(fd);
if ((unsigned)offset > tracks[track_widx].filesize)
offset = 0;
/* Set default values */ /* Set default values */
if (start_play) if (start_play)
{ {