1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-23 01:09:42 +01:00

* Added a safety check in PlaylistInterface to prevent infinite looping.

This commit is contained in:
Christian Muehlhaeuser 2012-11-28 12:48:58 +01:00
parent 580b18c561
commit 23fb6aec56

View File

@ -58,9 +58,13 @@ Tomahawk::result_ptr
PlaylistInterface::siblingResult( int itemsAway ) const
{
qint64 idx = siblingIndex( itemsAway );
qint64 safetyCheck = 0;
while ( idx >= 0 )
// If safetyCheck equals idx, this means the interface keeps returning the same item and we won't discover anything new - abort
// This can happen in repeat / random mode e.g.
while ( idx >= 0 && safetyCheck != idx )
{
safetyCheck = idx;
Tomahawk::query_ptr query = queryAt( idx );
if ( query->numResults() )
{