Skip to content

Commit

Permalink
If possible limit the number of tracks to remove the number in the pl…
Browse files Browse the repository at this point in the history
…aylist otherwise libspotify segfaults
  • Loading branch information
Tom committed Jan 9, 2012
1 parent 650a280 commit 79b8ba8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions server.c
Expand Up @@ -546,6 +546,13 @@ static void put_playlist_remove_tracks(sp_playlist *playlist,
return;
}

int num_tracks = count;
if (sp_playlist_is_loaded(playlist)) {
num_tracks = sp_playlist_num_tracks(playlist);
}

count = num_tracks < count ? num_tracks : count;

int *tracks = calloc(count, sizeof(int));

for (int i = 0; i < count; i++)
Expand Down

0 comments on commit 79b8ba8

Please sign in to comment.