[Telepathy-commits] [telepathy-salut/master] check if error is not NULL before calling g_error_new_literal

Guillaume Desmottes guillaume.desmottes at collabora.co.uk
Wed Nov 19 08:46:08 PST 2008


---
 src/salut-connection.c  |    5 +++--
 src/salut-muc-manager.c |   10 ++++++----
 src/salut-self.c        |   10 ++++++----
 3 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/src/salut-connection.c b/src/salut-connection.c
index 5d6798d..e4dd497 100644
--- a/src/salut-connection.c
+++ b/src/salut-connection.c
@@ -581,8 +581,9 @@ set_own_status (GObject *obj,
     }
   else
     {
-      *error = g_error_new_literal (TP_ERRORS, TP_ERROR_NETWORK_ERROR,
-          err->message);
+      if (error != NULL)
+        *error = g_error_new_literal (TP_ERRORS, TP_ERROR_NETWORK_ERROR,
+            err->message);
     }
 
   return TRUE;
diff --git a/src/salut-muc-manager.c b/src/salut-muc-manager.c
index 92aad20..6359066 100644
--- a/src/salut-muc-manager.c
+++ b/src/salut-muc-manager.c
@@ -563,8 +563,9 @@ salut_muc_manager_request_new_muc_channel (SalutMucManager *mgr,
   if (connection == NULL)
     {
       DEBUG ("get connection failed: %s", connection_error->message);
-      *error = g_error_new_literal (TP_ERRORS, TP_ERROR_NETWORK_ERROR,
-          connection_error->message);
+      if (error != NULL)
+        *error = g_error_new_literal (TP_ERRORS, TP_ERROR_NETWORK_ERROR,
+            connection_error->message);
       g_error_free (connection_error);
       return NULL;
     }
@@ -573,8 +574,9 @@ salut_muc_manager_request_new_muc_channel (SalutMucManager *mgr,
   if (!gibber_muc_connection_connect (connection, &connection_error))
     {
       DEBUG ("Connect failed: %s", connection_error->message);
-      *error = g_error_new_literal (TP_ERRORS, TP_ERROR_NETWORK_ERROR,
-          connection_error->message);
+      if (error != NULL)
+        *error = g_error_new_literal (TP_ERRORS, TP_ERROR_NETWORK_ERROR,
+            connection_error->message);
       g_error_free (connection_error);
       g_object_unref (connection);
       return NULL;
diff --git a/src/salut-self.c b/src/salut-self.c
index f43f534..c8d22bd 100644
--- a/src/salut-self.c
+++ b/src/salut-self.c
@@ -551,8 +551,9 @@ salut_self_set_alias (SalutSelf *self, const gchar *alias, GError **error)
   ret = SALUT_SELF_GET_CLASS (self)->set_alias (self, &err);
   if (!ret)
     {
-      *error = g_error_new_literal (TP_ERRORS, TP_ERROR_NETWORK_ERROR,
-          err->message);
+      if (error != NULL)
+        *error = g_error_new_literal (TP_ERRORS, TP_ERROR_NETWORK_ERROR,
+            err->message);
       g_error_free (err);
     }
   return ret;
@@ -593,8 +594,9 @@ salut_self_set_avatar (SalutSelf *self, guint8 *data,
   if (!ret)
     {
       salut_self_remove_avatar (self);
-      *error = g_error_new_literal (TP_ERRORS, TP_ERROR_NETWORK_ERROR,
-          err->message);
+      if (error != NULL)
+        *error = g_error_new_literal (TP_ERRORS, TP_ERROR_NETWORK_ERROR,
+            err->message);
       g_error_free (err);
     }
 
-- 
1.5.6.5




More information about the Telepathy-commits mailing list