mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-02 20:28:14 +02:00
Fixed TWK-1454: Don't crash when trying to set invalid current index.
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
*
|
*
|
||||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
* Copyright 2010-2014, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
* Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.org>
|
* Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.org>
|
||||||
* Copyright 2013, Teo Mrnjavac <teo@kde.org>
|
* Copyright 2013, Teo Mrnjavac <teo@kde.org>
|
||||||
*
|
*
|
||||||
@@ -61,9 +61,10 @@ AlbumPlaylistInterface::~AlbumPlaylistInterface()
|
|||||||
void
|
void
|
||||||
AlbumPlaylistInterface::setCurrentIndex( qint64 index )
|
AlbumPlaylistInterface::setCurrentIndex( qint64 index )
|
||||||
{
|
{
|
||||||
if ( index < m_queries.size() && !m_queries.at( index ).isNull() && m_queries.at( index )->results().size() > 0 ) {
|
if ( index >= 0 && index < m_queries.size() &&
|
||||||
|
!m_queries.at( index ).isNull() && m_queries.at( index )->results().size() > 0 )
|
||||||
|
{
|
||||||
PlaylistInterface::setCurrentIndex( index );
|
PlaylistInterface::setCurrentIndex( index );
|
||||||
|
|
||||||
m_currentItem = m_queries.at( index )->results().first();
|
m_currentItem = m_queries.at( index )->results().first();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
*
|
*
|
||||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
* Copyright 2010-2014, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
* Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.org>
|
* Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.org>
|
||||||
*
|
*
|
||||||
* Tomahawk is free software: you can redistribute it and/or modify
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
@@ -52,11 +52,14 @@ ArtistPlaylistInterface::~ArtistPlaylistInterface()
|
|||||||
|
|
||||||
void
|
void
|
||||||
ArtistPlaylistInterface::setCurrentIndex( qint64 index )
|
ArtistPlaylistInterface::setCurrentIndex( qint64 index )
|
||||||
|
{
|
||||||
|
if ( index >= 0 && index < m_queries.size() &&
|
||||||
|
!m_queries.at( index ).isNull() && m_queries.at( index )->results().size() > 0 )
|
||||||
{
|
{
|
||||||
PlaylistInterface::setCurrentIndex( index );
|
PlaylistInterface::setCurrentIndex( index );
|
||||||
|
|
||||||
m_currentItem = m_queries.at( index )->results().first();
|
m_currentItem = m_queries.at( index )->results().first();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
qint64
|
qint64
|
||||||
|
Reference in New Issue
Block a user