Commit 4aae8a68 authored by Cyril Deguet's avatar Cyril Deguet

- playlist.c: avoid a segfault when playlist_ViewFind() returns NULL.

 Anyway I guess it should not happen so there is a bug in the playlist
 code but I have no time to understand it...
parent a2de6063
...@@ -861,7 +861,11 @@ static playlist_item_t * NextItem( playlist_t *p_playlist ) ...@@ -861,7 +861,11 @@ static playlist_item_t * NextItem( playlist_t *p_playlist )
p_view = playlist_ViewFind( p_playlist,p_playlist->request.i_view ); p_view = playlist_ViewFind( p_playlist,p_playlist->request.i_view );
p_playlist->status.p_node = p_playlist->request.p_node; p_playlist->status.p_node = p_playlist->request.p_node;
p_playlist->status.i_view = p_playlist->request.i_view; p_playlist->status.i_view = p_playlist->request.i_view;
if( i_skip > 0 ) if( !p_view )
{
msg_Err( p_playlist, "p_view is NULL and should not! (FIXME)" );
}
else if( i_skip > 0 )
{ {
for( i = i_skip; i > 0 ; i-- ) for( i = i_skip; i > 0 ; i-- )
{ {
...@@ -939,6 +943,12 @@ static playlist_item_t * NextItem( playlist_t *p_playlist ) ...@@ -939,6 +943,12 @@ static playlist_item_t * NextItem( playlist_t *p_playlist )
playlist_view_t *p_view = playlist_view_t *p_view =
playlist_ViewFind( p_playlist, playlist_ViewFind( p_playlist,
p_playlist->status.i_view ); p_playlist->status.i_view );
if( !p_view )
{
msg_Err( p_playlist, "p_view is NULL and should not! (FIXME)" );
}
else
{
p_new = playlist_FindNextFromParent( p_playlist, p_new = playlist_FindNextFromParent( p_playlist,
p_playlist->status.i_view, p_playlist->status.i_view,
p_view->p_root, p_view->p_root,
...@@ -954,6 +964,7 @@ static playlist_item_t * NextItem( playlist_t *p_playlist ) ...@@ -954,6 +964,7 @@ static playlist_item_t * NextItem( playlist_t *p_playlist )
} }
} }
} }
}
/* Reset index */ /* Reset index */
if( p_playlist->i_index >= 0 && p_new != NULL && if( p_playlist->i_index >= 0 && p_new != NULL &&
......
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