[evolution-data-server] EBookClient/ECalClient: Check for NULL before calling g_strjoinv().



commit 89dd79cb4b6e2fe374a07b19e56868a82b5b6655
Author: Matthew Barnes <mbarnes redhat com>
Date:   Fri Feb 1 09:58:40 2013 -0500

    EBookClient/ECalClient: Check for NULL before calling g_strjoinv().

 addressbook/libebook/e-book-client.c |   23 +++++++++++++++++------
 calendar/libecal/e-cal-client.c      |   13 +++++++++----
 2 files changed, 26 insertions(+), 10 deletions(-)
---
diff --git a/addressbook/libebook/e-book-client.c b/addressbook/libebook/e-book-client.c
index 5ac915a..87f92aa 100644
--- a/addressbook/libebook/e-book-client.c
+++ b/addressbook/libebook/e-book-client.c
@@ -638,15 +638,17 @@ book_client_dbus_proxy_notify_cb (EDBusAddressBook *dbus_proxy,
 
 	if (g_str_equal (pspec->name, "capabilities")) {
 		gchar **strv;
-		gchar *csv;
+		gchar *csv = NULL;
 
 		backend_prop_name = CLIENT_BACKEND_PROPERTY_CAPABILITIES;
 
 		strv = e_dbus_address_book_dup_capabilities (dbus_proxy);
-		csv = g_strjoinv (",", strv);
+		if (strv != NULL) {
+			csv = g_strjoinv (",", strv);
+			g_strfreev (strv);
+		}
 		e_client_set_capabilities (E_CLIENT (book_client), csv);
 		g_free (csv);
-		g_free (strv);
 	}
 
 	if (g_str_equal (pspec->name, "online")) {
@@ -812,21 +814,30 @@ book_client_get_backend_property_sync (EClient *client,
 
 	if (g_str_equal (prop_name, CLIENT_BACKEND_PROPERTY_CAPABILITIES)) {
 		strv = e_dbus_address_book_dup_capabilities (dbus_proxy);
-		*prop_value = g_strjoinv (",", strv);
+		if (strv != NULL)
+			*prop_value = g_strjoinv (",", strv);
+		else
+			*prop_value = g_strdup ("");
 		g_strfreev (strv);
 		return TRUE;
 	}
 
 	if (g_str_equal (prop_name, BOOK_BACKEND_PROPERTY_REQUIRED_FIELDS)) {
 		strv = e_dbus_address_book_dup_required_fields (dbus_proxy);
-		*prop_value = g_strjoinv (",", strv);
+		if (strv != NULL)
+			*prop_value = g_strjoinv (",", strv);
+		else
+			*prop_value = g_strdup ("");
 		g_strfreev (strv);
 		return TRUE;
 	}
 
 	if (g_str_equal (prop_name, BOOK_BACKEND_PROPERTY_SUPPORTED_FIELDS)) {
 		strv = e_dbus_address_book_dup_supported_fields (dbus_proxy);
-		*prop_value = g_strjoinv (",", strv);
+		if (strv != NULL)
+			*prop_value = g_strjoinv (",", strv);
+		else
+			*prop_value = g_strdup ("");
 		g_strfreev (strv);
 		return TRUE;
 	}
diff --git a/calendar/libecal/e-cal-client.c b/calendar/libecal/e-cal-client.c
index 557c696..7b97192 100644
--- a/calendar/libecal/e-cal-client.c
+++ b/calendar/libecal/e-cal-client.c
@@ -753,15 +753,17 @@ cal_client_dbus_proxy_notify_cb (EDBusCalendar *dbus_proxy,
 
 	if (g_str_equal (pspec->name, "capabilities")) {
 		gchar **strv;
-		gchar *csv;
+		gchar *csv = NULL;
 
 		backend_prop_name = CLIENT_BACKEND_PROPERTY_CAPABILITIES;
 
 		strv = e_dbus_calendar_dup_capabilities (dbus_proxy);
-		csv = g_strjoinv (",", strv);
+		if (strv != NULL) {
+			csv = g_strjoinv (",", strv);
+			g_strfreev (strv);
+		}
 		e_client_set_capabilities (E_CLIENT (cal_client), csv);
 		g_free (csv);
-		g_free (strv);
 	}
 
 	if (g_str_equal (pspec->name, "default-object")) {
@@ -1010,7 +1012,10 @@ cal_client_get_backend_property_sync (EClient *client,
 
 	if (g_str_equal (prop_name, CLIENT_BACKEND_PROPERTY_CAPABILITIES)) {
 		strv = e_dbus_calendar_dup_capabilities (dbus_proxy);
-		*prop_value = g_strjoinv (",", strv);
+		if (strv != NULL)
+			*prop_value = g_strjoinv (",", strv);
+		else
+			*prop_value = g_strdup ("");
 		g_strfreev (strv);
 		return TRUE;
 	}



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