1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-07 06:36:55 +02:00

Increased pointer safety (oops 19400)

This commit is contained in:
Jeff Mitchell
2012-07-10 23:31:58 -04:00
committed by Christian Muehlhaeuser
parent 2142a04fda
commit f7240a5d39
2 changed files with 12 additions and 0 deletions

View File

@@ -272,9 +272,16 @@ Pipeline::reportResults( QID qid, const QList< result_ptr >& results )
}
const query_ptr& q = m_qids.value( qid );
Q_ASSERT( !q.isNull() );
if ( q.isNull() )
return;
QList< result_ptr > cleanResults;
foreach ( const result_ptr& r, results )
{
if ( r.isNull() )
continue;
float score = q->howSimilar( r );
r->setScore( score );
if ( !q->isFullTextQuery() && score < MINSCORE )

View File

@@ -498,6 +498,11 @@ Query::toString() const
float
Query::howSimilar( const Tomahawk::result_ptr& r )
{
Q_ASSERT( !r->artist().isNull() );
Q_ASSERT( !r->album().isNull() );
if ( r->artist().isNull() || r->album().isNull() )
return 0.0;
// result values
const QString rArtistname = r->artist()->sortname();
const QString rAlbumname = r->album()->sortname();