diff --git a/src/libtomahawk/AlbumPlaylistInterface.cpp b/src/libtomahawk/AlbumPlaylistInterface.cpp index cfe4fbdea..c5b4f60d9 100644 --- a/src/libtomahawk/AlbumPlaylistInterface.cpp +++ b/src/libtomahawk/AlbumPlaylistInterface.cpp @@ -1,6 +1,6 @@ /* === This file is part of Tomahawk Player - === * - * Copyright 2010-2011, Christian Muehlhaeuser + * Copyright 2010-2014, Christian Muehlhaeuser * Copyright 2010-2012, Jeff Mitchell * Copyright 2013, Teo Mrnjavac * @@ -61,10 +61,11 @@ AlbumPlaylistInterface::~AlbumPlaylistInterface() void AlbumPlaylistInterface::setCurrentIndex( qint64 index ) { - if ( index < m_queries.size() && !m_queries.at( index ).isNull() && m_queries.at( index )->results().size() > 0 ) { - PlaylistInterface::setCurrentIndex( index ); - - m_currentItem = m_queries.at( index )->results().first(); + if ( index >= 0 && index < m_queries.size() && + !m_queries.at( index ).isNull() && m_queries.at( index )->results().size() > 0 ) + { + PlaylistInterface::setCurrentIndex( index ); + m_currentItem = m_queries.at( index )->results().first(); } } diff --git a/src/libtomahawk/ArtistPlaylistInterface.cpp b/src/libtomahawk/ArtistPlaylistInterface.cpp index 5aa044cdd..d6a6568d8 100644 --- a/src/libtomahawk/ArtistPlaylistInterface.cpp +++ b/src/libtomahawk/ArtistPlaylistInterface.cpp @@ -1,6 +1,6 @@ /* === This file is part of Tomahawk Player - === * - * Copyright 2010-2011, Christian Muehlhaeuser + * Copyright 2010-2014, Christian Muehlhaeuser * Copyright 2010-2011, Jeff Mitchell * * Tomahawk is free software: you can redistribute it and/or modify @@ -53,9 +53,12 @@ ArtistPlaylistInterface::~ArtistPlaylistInterface() void ArtistPlaylistInterface::setCurrentIndex( qint64 index ) { - PlaylistInterface::setCurrentIndex( index ); - - m_currentItem = m_queries.at( index )->results().first(); + if ( index >= 0 && index < m_queries.size() && + !m_queries.at( index ).isNull() && m_queries.at( index )->results().size() > 0 ) + { + PlaylistInterface::setCurrentIndex( index ); + m_currentItem = m_queries.at( index )->results().first(); + } }