Skip to content

Commit

Permalink
Increased pointer safety (oops 19336)
Browse files Browse the repository at this point in the history
  • Loading branch information
jefferai authored and muesli committed Jul 12, 2012
1 parent 0406b38 commit 2142a04
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/libtomahawk/DropJob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() )
Expand All @@ -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 )
Expand Down

0 comments on commit 2142a04

Please sign in to comment.