ekiga r6089 - in trunk/lib/engine: addressbook/call-history presence/local-roster



Author: jpuydt
Date: Sat Mar 29 10:17:02 2008
New Revision: 6089
URL: http://svn.gnome.org/viewvc/ekiga?rev=6089&view=rev

Log:
Fix possible initialization of std::string through NULL


Modified:
   trunk/lib/engine/addressbook/call-history/history-contact.cpp
   trunk/lib/engine/presence/local-roster/local-presentity.cpp

Modified: trunk/lib/engine/addressbook/call-history/history-contact.cpp
==============================================================================
--- trunk/lib/engine/addressbook/call-history/history-contact.cpp	(original)
+++ trunk/lib/engine/addressbook/call-history/history-contact.cpp	Sat Mar 29 10:17:02 2008
@@ -47,11 +47,13 @@
     = dynamic_cast<Ekiga::ContactCore*>(core.get ("contact-core"));
 
   xml_str = xmlGetProp (node, (const xmlChar *)"type");
-  groups.insert ((const char *)xml_str);
+  if (xml_str != NULL)
+    groups.insert ((const char *)xml_str);
   xmlFree (xml_str);
 
   xml_str = xmlGetProp (node, (const xmlChar *)"uri");
-  uri = (const char *)xml_str;
+  if (xml_str != NULL)
+    uri = (const char *)xml_str;
   xmlFree (xml_str);
 
   for (xmlNodePtr child = node->children ;
@@ -64,14 +66,16 @@
       if (xmlStrEqual (BAD_CAST ("name"), child->name)) {
 
         xml_str = xmlNodeGetContent (child);
-        name = (const char *)xml_str;
+	if (xml_str != NULL)
+	  name = (const char *)xml_str;
         xmlFree (xml_str);
       }
 
       if (xmlStrEqual (BAD_CAST ("status"), child->name)) {
 
         xml_str = xmlNodeGetContent (child);
-        status = (const char *)xml_str;
+	if (xml_str != NULL)
+	  status = (const char *)xml_str;
         xmlFree (xml_str);
       }
     }

Modified: trunk/lib/engine/presence/local-roster/local-presentity.cpp
==============================================================================
--- trunk/lib/engine/presence/local-roster/local-presentity.cpp	(original)
+++ trunk/lib/engine/presence/local-roster/local-presentity.cpp	Sat Mar 29 10:17:02 2008
@@ -56,7 +56,8 @@
   presence_core = dynamic_cast<Ekiga::PresenceCore*>(core.get ("presence-core"));
 
   xml_str = xmlGetProp (node, (const xmlChar *)"uri");
-  uri = (const char *)xml_str;
+  if (xml_str != NULL)
+    uri = (const char *)xml_str;
   xmlFree (xml_str);
 
   for (xmlNodePtr child = node->children ;
@@ -69,7 +70,8 @@
       if (xmlStrEqual (BAD_CAST ("name"), child->name)) {
 
         xml_str = xmlNodeGetContent (child);
-        name = (const char *)xml_str;
+	if (xml_str != NULL)
+	  name = (const char *)xml_str;
 	name_node = child;
         xmlFree (xml_str);
       }
@@ -77,7 +79,10 @@
       if (xmlStrEqual (BAD_CAST ("group"), child->name)) {
 
         xml_str = xmlNodeGetContent (child);
-	group_nodes[(const char *)xml_str] = child;
+	if (xml_str != NULL)
+	  group_nodes[(const char *)xml_str] = child;
+	else
+	  group_nodes[""] = child;
         xmlFree (xml_str);
       }
     }



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