gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r5782 - gnunet-qt/src/plugins/general


From: gnunet
Subject: [GNUnet-SVN] r5782 - gnunet-qt/src/plugins/general
Date: Wed, 28 Nov 2007 14:38:10 -0700 (MST)

Author: durner
Date: 2007-11-28 14:38:10 -0700 (Wed, 28 Nov 2007)
New Revision: 5782

Modified:
   gnunet-qt/src/plugins/general/checkDaemonThread.cc
Log:
fix crash if gnunet-qt failed to get the list of applications from gnunetd

Modified: gnunet-qt/src/plugins/general/checkDaemonThread.cc
===================================================================
--- gnunet-qt/src/plugins/general/checkDaemonThread.cc  2007-11-28 17:16:23 UTC 
(rev 5781)
+++ gnunet-qt/src/plugins/general/checkDaemonThread.cc  2007-11-28 21:38:10 UTC 
(rev 5782)
@@ -76,26 +76,30 @@
       if (sock)
       {
         char *apps = GNUNET_get_daemon_configuration_value(sock, "GNUNETD", 
"APPLICATIONS");
-        QString strApps = GString::fromLocal8Bit(apps);
-        QStringList appList = strApps.split(QRegExp("\\s+"));
-  
-        int count = appList.count();
-        while(count)
-        { 
-          GGNUnetAppDesc appDesc;
+        
+        if (apps)
+        {
+          QString strApps = GString::fromLocal8Bit(apps);
+          QStringList appList = strApps.split(QRegExp("\\s+"));
+    
+          int count = appList.count();
+          while(count)
+          { 
+            GGNUnetAppDesc appDesc;
+            
+            appDesc.strApp = appList.takeFirst();
+            char *app = appDesc.strApp.toCString();
+            char *desc = GNUNET_get_daemon_configuration_value(sock, "ABOUT", 
app);
+            appDesc.strDesc = GString::fromLocal8Bit(desc);
+            descs->append(appDesc);
+    
+            GNUNET_free_non_null(desc);
+    
+            count--;
+          }
           
-          appDesc.strApp = appList.takeFirst();
-          char *app = appDesc.strApp.toCString();
-          char *desc = GNUNET_get_daemon_configuration_value(sock, "ABOUT", 
app);
-          appDesc.strDesc = GString::fromLocal8Bit(desc);
-          descs->append(appDesc);
-  
-          GNUNET_free_non_null(desc);
-  
-          count--;
+          GNUNET_free(apps);
         }
-        
-        GNUNET_free(apps);
         GNUNET_client_connection_destroy(sock);
 
         checkAppsIn = 20; // 5 minutes / 15 seconds = 20 runs





reply via email to

[Prev in Thread] Current Thread [Next in Thread]