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

List:       kde-commits
Subject:    [plasmate/terietor/tools] engineexplorer: Don't assert on nullptr service. Show a warning instead an
From:       Shaun Reich <shaun.reich () kdemail ! net>
Date:       2012-08-16 18:41:51
Message-ID: 20120816184151.8DCC1A60EC () git ! kde ! org
[Download RAW message or body]

Git commit 806290d78b63d9529bcdf24d28e4fc45d1c17331 by Shaun Reich.
Committed on 12/01/2012 at 21:06.
Pushed by tsiapaliwkas into branch 'terietor/tools'.

Don't assert on nullptr service. Show a warning instead and be happy.

M  +12   -7    engineexplorer/serviceviewer.cpp

http://commits.kde.org/plasmate/806290d78b63d9529bcdf24d28e4fc45d1c17331

diff --git a/engineexplorer/serviceviewer.cpp b/engineexplorer/serviceviewer.cpp
index ebff97a..79388e5 100644
--- a/engineexplorer/serviceviewer.cpp
+++ b/engineexplorer/serviceviewer.cpp
@@ -56,13 +56,18 @@ ServiceViewer::ServiceViewer(Plasma::DataEngine *engine, const \
QString &source,  if (m_engine) {
         engineName = KStringHandler::capwords(m_engine->name());
         m_service = m_engine->serviceForSource(m_source);
-        Q_ASSERT(m_service);
-        serviceName = m_service->name();
-        updateOperations();
-        connect(m_service, SIGNAL(operationsChanged()), this, \
                SLOT(updateOperations()));
-        connect(m_service, SIGNAL(finished(Plasma::ServiceJob*)), this,
-                SLOT(operationResult(Plasma::ServiceJob*)));
-        connect(m_engine, SIGNAL(destroyed(QObject*)), this, \
SLOT(engineDestroyed())); +
+        if (m_service != 0) {
+            serviceName = m_service->name();
+            updateOperations();
+            connect(m_service, SIGNAL(operationsChanged()), this, \
SLOT(updateOperations())); +            connect(m_service, \
SIGNAL(finished(Plasma::ServiceJob*)), this, +                    \
SLOT(operationResult(Plasma::ServiceJob*))); +            connect(m_engine, \
SIGNAL(destroyed(QObject*)), this, SLOT(engineDestroyed())); +        } else {
+            KMessageBox::sorry(this, i18n("No valid service was returned. Verify \
that a service is available for this source.")); +            close();
+        }
     }
 
     setWindowTitle(i18nc("%1 is a Plasma service name", "%1 Service Explorer", \
serviceName));


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

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