mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 06:07:37 +02:00
Increased pointer safety (oops 19336)
This commit is contained in:
@@ -699,8 +699,21 @@ DropJob::removeDuplicates()
|
|||||||
foreach ( const Tomahawk::query_ptr& item, m_resultList )
|
foreach ( const Tomahawk::query_ptr& item, m_resultList )
|
||||||
{
|
{
|
||||||
bool contains = false;
|
bool contains = false;
|
||||||
|
Q_ASSERT( !item.isNull() );
|
||||||
|
if ( item.isNull() )
|
||||||
|
{
|
||||||
|
m_resultList.removeOne( item );
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
foreach( const Tomahawk::query_ptr &tmpItem, list )
|
foreach( const Tomahawk::query_ptr &tmpItem, list )
|
||||||
{
|
{
|
||||||
|
if ( tmpItem.isNull() )
|
||||||
|
{
|
||||||
|
list.removeOne( tmpItem );
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if ( item->album() == tmpItem->album()
|
if ( item->album() == tmpItem->album()
|
||||||
&& item->artist() == tmpItem->artist()
|
&& item->artist() == tmpItem->artist()
|
||||||
&& item->track() == tmpItem->track() )
|
&& item->track() == tmpItem->track() )
|
||||||
@@ -726,10 +739,18 @@ DropJob::removeRemoteSources()
|
|||||||
QList< Tomahawk::query_ptr > list;
|
QList< Tomahawk::query_ptr > list;
|
||||||
foreach ( const Tomahawk::query_ptr& item, m_resultList )
|
foreach ( const Tomahawk::query_ptr& item, m_resultList )
|
||||||
{
|
{
|
||||||
|
Q_ASSERT( !item.isNull() );
|
||||||
|
if ( item.isNull() )
|
||||||
|
{
|
||||||
|
m_resultList.removeOne( item );
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
bool hasLocalSource = false;
|
bool hasLocalSource = false;
|
||||||
foreach ( const Tomahawk::result_ptr& result, item->results() )
|
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;
|
hasLocalSource = true;
|
||||||
}
|
}
|
||||||
if ( hasLocalSource )
|
if ( hasLocalSource )
|
||||||
|
Reference in New Issue
Block a user