1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-04-08 10:02:29 +02:00

Increased pointer safety (oops 19336)

This commit is contained in:
Jeff Mitchell 2012-07-10 23:27:14 -04:00
parent e9314775aa
commit d2a5092862

View File

@ -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 )