mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-10 16:14:40 +02:00
Increased pointer safety (oops 19400)
This commit is contained in:
committed by
Christian Muehlhaeuser
parent
2142a04fda
commit
f7240a5d39
@@ -272,9 +272,16 @@ Pipeline::reportResults( QID qid, const QList< result_ptr >& results )
|
|||||||
}
|
}
|
||||||
const query_ptr& q = m_qids.value( qid );
|
const query_ptr& q = m_qids.value( qid );
|
||||||
|
|
||||||
|
Q_ASSERT( !q.isNull() );
|
||||||
|
if ( q.isNull() )
|
||||||
|
return;
|
||||||
|
|
||||||
QList< result_ptr > cleanResults;
|
QList< result_ptr > cleanResults;
|
||||||
foreach ( const result_ptr& r, results )
|
foreach ( const result_ptr& r, results )
|
||||||
{
|
{
|
||||||
|
if ( r.isNull() )
|
||||||
|
continue;
|
||||||
|
|
||||||
float score = q->howSimilar( r );
|
float score = q->howSimilar( r );
|
||||||
r->setScore( score );
|
r->setScore( score );
|
||||||
if ( !q->isFullTextQuery() && score < MINSCORE )
|
if ( !q->isFullTextQuery() && score < MINSCORE )
|
||||||
|
@@ -498,6 +498,11 @@ Query::toString() const
|
|||||||
float
|
float
|
||||||
Query::howSimilar( const Tomahawk::result_ptr& r )
|
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
|
// result values
|
||||||
const QString rArtistname = r->artist()->sortname();
|
const QString rArtistname = r->artist()->sortname();
|
||||||
const QString rAlbumname = r->album()->sortname();
|
const QString rAlbumname = r->album()->sortname();
|
||||||
|
Reference in New Issue
Block a user