]> git.sesse.net Git - vlc/commitdiff
quit fast when sorting a playlist with 1 or less entries. Fixes a crash when
authorSigmund Augdal Helberg <sigmunau@videolan.org>
Thu, 1 Jul 2004 12:37:53 +0000 (12:37 +0000)
committerSigmund Augdal Helberg <sigmunau@videolan.org>
Thu, 1 Jul 2004 12:37:53 +0000 (12:37 +0000)
shuffeling a playlist with 1 entry

src/playlist/sort.c

index 855d305a4ceb6fd2aeb054786fdb6710f2d91551..2d0a0f9a8dad13833a228cc0662c34cdc2c10e11 100644 (file)
@@ -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 )
     {