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

List:       kde-commits
Subject:    KDE/kdelibs/kdecore/services
From:       David Faure <faure () kde ! org>
Date:       2010-01-07 20:14:02
Message-ID: 1262895242.188006.11185.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1071283 by dfaure:

Check the servicetype in both methods, thx kdepepo for noticing


 M  +11 -6     kmimetypetrader.cpp  


--- trunk/KDE/kdelibs/kdecore/services/kmimetypetrader.cpp #1071282:1071283
@@ -78,6 +78,13 @@
     return lst;
 }
 
+#define CHECK_SERVICETYPE(genericServiceTypePtr) \
+    if (!genericServiceTypePtr) { \
+        kError(7014) << "KMimeTypeTrader: couldn't find service type" << genericServiceType << \
+            "\nPlease ensure that the .desktop file for it is installed; then run kbuildsycoca4."; \
+        return; \
+    }
+
 /**
  * Filter the offers for the requested mime type for the genericServiceType.
  *
@@ -87,11 +94,7 @@
 static void filterMimeTypeOffers(KServiceOfferList& list, const QString& genericServiceType)
 {
     KServiceType::Ptr genericServiceTypePtr = KServiceType::serviceType(genericServiceType);
-    if (!genericServiceTypePtr) {
-        kError(7014) << "KMimeTypeTrader: couldn't find service type" << genericServiceType <<
-            "\nPlease ensure that the .desktop file for it is installed; then run kbuildsycoca4.";
-        return;
-    }
+    CHECK_SERVICETYPE(genericServiceTypePtr);
 
     QMutableListIterator<KServiceOffer> it(list);
     while(it.hasNext()) {
@@ -108,7 +111,7 @@
 static void filterMimeTypeOffers(KService::List& list, const QString& genericServiceType)
 {
     KServiceType::Ptr genericServiceTypePtr = KServiceType::serviceType(genericServiceType);
-    Q_ASSERT(genericServiceTypePtr);
+    CHECK_SERVICETYPE(genericServiceTypePtr);
 
     QMutableListIterator<KService::Ptr> it(list);
     while(it.hasNext()) {
@@ -122,6 +125,8 @@
     }
 }
 
+#undef CHECK_SERVICETYPE
+
 KService::List KMimeTypeTrader::query( const QString& mimeType,
                                        const QString& genericServiceType,
                                        const QString& constraint ) const
[prev in list] [next in list] [prev in thread] [next in thread] 

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