From cd071db6cc40a8a04de68929b77d3f1960b2af1f Mon Sep 17 00:00:00 2001 From: Sigmund Augdal Helberg Date: Thu, 1 Jul 2004 12:37:53 +0000 Subject: [PATCH] quit fast when sorting a playlist with 1 or less entries. Fixes a crash when shuffeling a playlist with 1 entry --- src/playlist/sort.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/playlist/sort.c b/src/playlist/sort.c index 855d305a4c..2d0a0f9a8d 100644 --- a/src/playlist/sort.c +++ b/src/playlist/sort.c @@ -49,6 +49,17 @@ int playlist_Sort( playlist_t * p_playlist , int i_mode, int i_type ) p_playlist->i_sort = i_mode; p_playlist->i_order = i_type; + /* playlist with one or less items are allways sorted in all + manners, quit fast. */ + if( p_playlist->i_size <= 1 ) + { + vlc_mutex_unlock( &p_playlist->object_lock ); + + /* Notify the interfaces, is this necessary? */ + var_Set( p_playlist, "intf-change", val ); + + return VLC_SUCCESS; + } if( i_mode == SORT_RANDOM ) { -- 2.39.2