Return immediately if we have no control commands to flush. Fixes erroneous playlist control update error when inserting tracks

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9912 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Hardeep Sidhu 2006-05-11 19:14:18 +00:00
parent a65ec01405
commit cab3a16417

View file

@ -1652,6 +1652,9 @@ static int flush_cached_control(struct playlist_info* playlist)
int result = 0; int result = 0;
int i; int i;
if (!playlist->num_cached)
return 0;
lseek(playlist->control_fd, 0, SEEK_END); lseek(playlist->control_fd, 0, SEEK_END);
for (i=0; i<playlist->num_cached; i++) for (i=0; i<playlist->num_cached; i++)
@ -1714,12 +1717,9 @@ static int flush_cached_control(struct playlist_info* playlist)
result = 0; result = 0;
} }
else else
result = -1;
if (result < 0)
{ {
result = -1;
gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR)); gui_syncsplash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR));
return result;
} }
return result; return result;