From 5b213f1ac4ce0c3ebaa0125a661720a0cfbde91f Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Wed, 28 Nov 2012 12:54:48 +0100 Subject: [PATCH] * Be more consistent when enabling the prev/next buttons. --- .../playlist/PlayableProxyModelPlaylistInterface.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/libtomahawk/playlist/PlayableProxyModelPlaylistInterface.cpp b/src/libtomahawk/playlist/PlayableProxyModelPlaylistInterface.cpp index 850bf0b20..5bb3c3dbd 100644 --- a/src/libtomahawk/playlist/PlayableProxyModelPlaylistInterface.cpp +++ b/src/libtomahawk/playlist/PlayableProxyModelPlaylistInterface.cpp @@ -191,6 +191,9 @@ PlayableProxyModelPlaylistInterface::siblingIndex( int itemsAway, qint64 rootInd } else { + if ( !proxyModel->currentIndex().isValid() ) + return -1; + // random mode is enabled if ( m_shuffleCache.isValid() ) { @@ -207,7 +210,7 @@ PlayableProxyModelPlaylistInterface::siblingIndex( int itemsAway, qint64 rootInd item = proxyModel->itemFromIndex( proxyModel->mapToSource( idx ) ); } while ( safetyCounter < proxyModel->rowCount() && - ( !item || !item->query()->playable() || m_shuffleHistory.contains( item->query() ) ) ); + ( !item || !item->query()->playable() || m_shuffleHistory.contains( item->query() ) ) ); if ( item && item->query()->playable() ) { @@ -252,6 +255,9 @@ PlayableProxyModelPlaylistInterface::siblingIndex( int itemsAway, qint64 rootInd if ( !idx.isValid() && m_repeatMode == PlaylistModes::RepeatAll ) { + if ( !proxyModel->currentIndex().isValid() ) + return -1; + // repeat all tracks if ( itemsAway > 0 ) {