[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/multimedia/amarok/src/servicebrowser
From:       Seb Ruiz <me () sebruiz ! net>
Date:       2007-06-25 11:53:57
Message-ID: 1182772437.788478.17061.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 680082 by seb:

Sanity checking for d ptr and dynamic casts. Coverity fixes 3719, 3720 & 3721.


 M  +7 -2      servicesqlquerymaker.cpp  


--- trunk/extragear/multimedia/amarok/src/servicebrowser/servicesqlquerymaker.cpp #680081:680082
@@ -297,9 +297,11 @@
 {
     DEBUG_BLOCK
     QString prefix = m_metaFactory->tablePrefix(); 
-    if (d->queryType == Private::TRACK ) // a service track does not generally know its artist
+    if( d && d->queryType == Private::TRACK ) // a service track does not generally know its artist
         return this;
     const ServiceArtist * serviceArtist = dynamic_cast<const ServiceArtist *>( artist.data() );
+    if( !d || !serviceArtist )
+        return this;
     d->queryMatch += QString( " AND " + prefix + "_albums.artist_id= '%1'" ).arg( serviceArtist->id() );
     return this;
 }
@@ -310,6 +312,8 @@
     DEBUG_BLOCK
     QString prefix = m_metaFactory->tablePrefix(); 
     const ServiceAlbum * serviceAlbum = dynamic_cast<const ServiceAlbum *>( album.data() );
+    if( !d || !serviceAlbum )
+        return this;
     d->queryMatch += QString( " AND " + prefix + "_tracks.album_id = '%1'" ).arg( serviceAlbum->id() );
     return this;
 }
@@ -321,6 +325,8 @@
     QString prefix = m_metaFactory->tablePrefix(); 
 
     const ServiceGenre* serviceGenre = dynamic_cast<const ServiceGenre *>( genre.data() );
+    if( !d || !serviceGenre )
+        return this;
     d->linkedTables |= Private::GENRE_TABLE;
     if ( d->queryType == Private::ARTIST ) //HACK!
         d->queryMatch += QString( " AND " + prefix + "_genre.name = '%1'" ).arg( serviceGenre->name() );
@@ -377,7 +383,6 @@
 QueryMaker*
 ServiceSqlQueryMaker::addReturnValue( qint64 value )
 {
-
     Q_UNUSED( value );
     /*if( d->queryType == Private::CUSTOM )
     {
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic