Commit 6d46c2a1 authored by Gildas Bazin's avatar Gildas Bazin

* modules/control/http.c: fixed segfault when deleting items and prevent adding empty items.
parent fd6e137a
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* http.c : http mini-server ;) * http.c : http mini-server ;)
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: http.c,v 1.38 2003/11/23 16:24:20 garf Exp $ * $Id: http.c,v 1.39 2003/11/23 17:46:06 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* Laurent Aimar <fenrir@via.ecp.fr> * Laurent Aimar <fenrir@via.ecp.fr>
...@@ -1754,7 +1754,7 @@ static void MacroDo( httpd_file_callback_args_t *p_args, ...@@ -1754,7 +1754,7 @@ static void MacroDo( httpd_file_callback_args_t *p_args,
uri_decode_url_encoded( mrl ); uri_decode_url_encoded( mrl );
p_item = parse_MRL( mrl ); p_item = parse_MRL( mrl );
if( p_item == NULL ) if( !p_item || !*p_item )
{ {
msg_Dbg( p_intf, "invalid requested mrl: %s", mrl ); msg_Dbg( p_intf, "invalid requested mrl: %s", mrl );
} else } else
...@@ -1810,10 +1810,9 @@ static void MacroDo( httpd_file_callback_args_t *p_args, ...@@ -1810,10 +1810,9 @@ static void MacroDo( httpd_file_callback_args_t *p_args,
} }
case MVLC_KEEP: case MVLC_KEEP:
{ {
int i_item, *p_items = NULL, i_nb_items = 0, i_current = -1; int i_item, *p_items = NULL, i_nb_items = 0;
char item[512], *p_parser = p_request; char item[512], *p_parser = p_request;
int i,j; int i,j;
vlc_value_t val;
/* Get the list of items to keep */ /* Get the list of items to keep */
while( (p_parser = while( (p_parser =
...@@ -1828,16 +1827,6 @@ static void MacroDo( httpd_file_callback_args_t *p_args, ...@@ -1828,16 +1827,6 @@ static void MacroDo( httpd_file_callback_args_t *p_args,
i_nb_items++; i_nb_items++;
} }
/* we should not remove an item while it is played by VLC */
var_Get( p_sys->p_input, "state", &val );
if( val.i_int == PLAYING_S )
{
i_current = p_sys->p_playlist->i_index;
} else
{
i_current = -1;
}
/* The items need to be deleted from in reversed order */ /* The items need to be deleted from in reversed order */
for( i = p_sys->p_playlist->i_size - 1; i >= 0 ; i-- ) for( i = p_sys->p_playlist->i_size - 1; i >= 0 ; i-- )
{ {
...@@ -1846,7 +1835,7 @@ static void MacroDo( httpd_file_callback_args_t *p_args, ...@@ -1846,7 +1835,7 @@ static void MacroDo( httpd_file_callback_args_t *p_args,
{ {
if( p_items[j] == i ) break; if( p_items[j] == i ) break;
} }
if( (j == i_nb_items) && (i != i_current ) ) if( j == i_nb_items )
{ {
playlist_Delete( p_sys->p_playlist, i ); playlist_Delete( p_sys->p_playlist, i );
msg_Dbg( p_intf, "requested playlist delete: %d", msg_Dbg( p_intf, "requested playlist delete: %d",
......
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