diff --git a/src/libtomahawk/DropJob.cpp b/src/libtomahawk/DropJob.cpp index 5f1cea4bd..ee8b5f791 100644 --- a/src/libtomahawk/DropJob.cpp +++ b/src/libtomahawk/DropJob.cpp @@ -699,8 +699,21 @@ DropJob::removeDuplicates() foreach ( const Tomahawk::query_ptr& item, m_resultList ) { bool contains = false; + Q_ASSERT( !item.isNull() ); + if ( item.isNull() ) + { + m_resultList.removeOne( item ); + continue; + } + foreach( const Tomahawk::query_ptr &tmpItem, list ) { + if ( tmpItem.isNull() ) + { + list.removeOne( tmpItem ); + continue; + } + if ( item->album() == tmpItem->album() && item->artist() == tmpItem->artist() && item->track() == tmpItem->track() ) @@ -726,10 +739,18 @@ DropJob::removeRemoteSources() QList< Tomahawk::query_ptr > list; foreach ( const Tomahawk::query_ptr& item, m_resultList ) { + Q_ASSERT( !item.isNull() ); + if ( item.isNull() ) + { + m_resultList.removeOne( item ); + continue; + } + bool hasLocalSource = false; foreach ( const Tomahawk::result_ptr& result, item->results() ) { - if ( !result->collection()->source().isNull() && result->collection()->source()->isLocal() ) + if ( !result->collection().isNull() && !result->collection()->source().isNull() && + !result->collection()->source().isNull() && result->collection()->source()->isLocal() ) hasLocalSource = true; } if ( hasLocalSource )