[vlmc-devel] MediaLibraryModel: Fix rowCount method

Hugo Beauzée-Luyssen git at videolan.org
Tue Jul 12 00:26:41 CEST 2016


vlmc | branch: medialibrary | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Mon Jul 11 22:00:16 2016 +0200| [f63e1377c3a55b0ffddd5d9cd44f2f8894912702] | committer: Hugo Beauzée-Luyssen

MediaLibraryModel: Fix rowCount method

> https://code.videolan.org/videolan/vlmc/commit/f63e1377c3a55b0ffddd5d9cd44f2f8894912702
---

 src/Library/MediaLibraryModel.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/Library/MediaLibraryModel.cpp b/src/Library/MediaLibraryModel.cpp
index 9710831..8b86cc1 100644
--- a/src/Library/MediaLibraryModel.cpp
+++ b/src/Library/MediaLibraryModel.cpp
@@ -70,8 +70,12 @@ bool MediaLibraryModel::removeMedia( int64_t mediaId )
     return true;
 }
 
-int MediaLibraryModel::rowCount( const QModelIndex& ) const
+int MediaLibraryModel::rowCount( const QModelIndex& index ) const
 {
+    // A valid index is any row, which doesn't have child
+    // An invalid index is the root node, which does have children
+    if ( index.isValid() == true )
+        return 0;
     return m_rowCount.load( std::memory_order_relaxed );
 }
 



More information about the Vlmc-devel mailing list