1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-04-20 16:02:07 +02:00

* Don't try removing rows when the model is empty.

This commit is contained in:
Christian Muehlhaeuser 2010-10-24 05:01:51 +02:00
parent e11e74c25e
commit fd0a27fc7c

View File

@ -47,10 +47,13 @@ PlaylistModel::loadPlaylist( const Tomahawk::playlist_ptr& playlist )
if ( !m_playlist.isNull() )
disconnect( m_playlist.data(), SIGNAL( revisionLoaded( Tomahawk::PlaylistRevision ) ), this, SLOT( onRevisionLoaded( Tomahawk::PlaylistRevision ) ) );
emit beginRemoveRows( QModelIndex(), 0, rowCount( QModelIndex() ) - 1 );
delete m_rootItem;
m_rootItem = new PlItem( 0, this );
emit endRemoveRows();
if ( rowCount( QModelIndex() ) )
{
emit beginRemoveRows( QModelIndex(), 0, rowCount( QModelIndex() ) - 1 );
delete m_rootItem;
m_rootItem = new PlItem( 0, this );
emit endRemoveRows();
}
m_playlist = playlist;
connect( playlist.data(), SIGNAL( revisionLoaded( Tomahawk::PlaylistRevision ) ), SLOT( onRevisionLoaded( Tomahawk::PlaylistRevision ) ) );