Qt4 - fix QT playlist display bug when clicking on top-level of playlist.
authorJean-Baptiste Kempf <jb@videolan.org>
Mon, 6 Aug 2007 17:03:01 +0000 (17:03 +0000)
committerJean-Baptiste Kempf <jb@videolan.org>
Mon, 6 Aug 2007 17:03:01 +0000 (17:03 +0000)
Patch by Alexander Gall. Thanks.

modules/gui/qt4/playlist_model.cpp

index af819c8..0d7c2fe 100644 (file)
@@ -745,11 +745,14 @@ void PLModel::rebuild( playlist_item_t *p_root )
     /* Clear the tree */
     if( rootItem )
     {
-        beginRemoveRows( index( rootItem, 0 ), 0,
-                         rootItem->children.size() -1 );
-        qDeleteAll( rootItem->children );
-        rootItem->children.clear();
-        endRemoveRows();
+        if( rootItem->children.size() )
+        {
+            beginRemoveRows( index( rootItem, 0 ), 0,
+                    rootItem->children.size() -1 );
+            qDeleteAll( rootItem->children );
+            rootItem->children.clear();
+            endRemoveRows();
+        }
     }
     if( p_root )
     {