Commit c2510014 authored by Clément Stenac's avatar Clément Stenac

Don't fuck up index on delete (fix crash for skins2) - Refs #205

parent c9bd423d
......@@ -622,6 +622,7 @@ int playlist_Replace( playlist_t *p_playlist, playlist_item_t *p_olditem,
int playlist_Delete( playlist_t * p_playlist, int i_id )
{
int i, i_top, i_bottom;
int i_pos;
vlc_bool_t b_flag = VLC_FALSE;
playlist_item_t *p_item = playlist_ItemGetById( p_playlist, i_id );
......@@ -668,6 +669,14 @@ int playlist_Delete( playlist_t * p_playlist, int i_id )
b_flag = VLC_TRUE;
}
/* Get position and update index if needed */
i_pos = playlist_GetPositionById( p_playlist, i_id );
if( i_pos >= 0 && i_pos <= p_playlist->i_index )
{
p_playlist->i_index--;
}
msg_Dbg( p_playlist, "deleting playlist item `%s'",
p_item->input.psz_name );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment