[vlc-devel] commit: qt4 playlist: fix crash at "vlc --no-media-library" (Jakob Leben )

git version control git at videolan.org
Thu Aug 20 10:51:01 CEST 2009


vlc | branch: master | Jakob Leben <jleben at videolan.org> | Thu Aug 20 10:47:41 2009 +0200| [2dc5dff316fa49fb48bd1f75a109c6d939d5a9f1] | committer: Jakob Leben 

qt4 playlist: fix crash at "vlc --no-media-library"

It's ugly, but it will do.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2dc5dff316fa49fb48bd1f75a109c6d939d5a9f1
---

 .../gui/qt4/components/playlist/playlist_model.cpp |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/modules/gui/qt4/components/playlist/playlist_model.cpp b/modules/gui/qt4/components/playlist/playlist_model.cpp
index 0134028..e8b3482 100644
--- a/modules/gui/qt4/components/playlist/playlist_model.cpp
+++ b/modules/gui/qt4/components/playlist/playlist_model.cpp
@@ -132,18 +132,21 @@ Qt::ItemFlags PLModel::flags( const QModelIndex &index ) const
 
     PLItem *item = index.isValid() ? getItem( index ) : rootItem;
 
-    input_item_t *pl_input = p_playlist->p_local_category->p_input;
-    input_item_t *ml_input = p_playlist->p_ml_category->p_input;
+    input_item_t *pl_input =
+        p_playlist->p_local_category ?
+        p_playlist->p_local_category->p_input : NULL;
+    input_item_t *ml_input =
+        p_playlist->p_ml_category ?
+        p_playlist->p_ml_category->p_input : NULL;
 
-    if( rootItem->i_id == p_playlist->p_root_onelevel->i_id
-          || rootItem->i_id == p_playlist->p_root_category->i_id )
+    if( i_depth == DEPTH_SEL )
     {
-        if( item->p_input == pl_input
-            || item->p_input == ml_input)
+        if( ( pl_input && item->p_input == pl_input ) ||
+            ( ml_input && item->p_input == ml_input ) )
                 flags |= Qt::ItemIsDropEnabled;
     }
-    else if( rootItem->p_input == pl_input ||
-            rootItem->p_input == ml_input )
+    else if( ( pl_input && rootItem->p_input == pl_input ) ||
+              ( ml_input && rootItem->p_input == ml_input ) )
     {
         PL_LOCK;
         playlist_item_t *plItem =




More information about the vlc-devel mailing list