[Telepathy-commits] [telepathy-salut/master] Allow update and stop_announce to be called on activities that aren't actually announced. So the higher level code doesn't have to remember whether announcing it actually succeeded

Sjoerd Simons sjoerd.simons at collabora.co.uk
Mon Sep 15 07:47:30 PDT 2008


---
 src/salut-avahi-olpc-activity.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/salut-avahi-olpc-activity.c b/src/salut-avahi-olpc-activity.c
index 702d55b..adaaeb6 100644
--- a/src/salut-avahi-olpc-activity.c
+++ b/src/salut-avahi-olpc-activity.c
@@ -125,7 +125,12 @@ update_activity_service (SalutAvahiOlpcActivity *self,
       self);
   GError *err = NULL;
 
-  g_return_val_if_fail (activity_is_announced (self), FALSE);
+  if (!activity_is_announced (self))
+    {
+      g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
+        "Trying to update an activity that's not announced");
+      return FALSE;
+    }
 
   ga_entry_group_service_freeze (priv->service);
 
@@ -217,7 +222,10 @@ salut_avahi_olpc_activity_stop_announce (SalutOlpcActivity *activity)
   SalutAvahiOlpcActivityPrivate *priv = SALUT_AVAHI_OLPC_ACTIVITY_GET_PRIVATE (
       self);
 
-  g_return_if_fail (activity_is_announced (self));
+  /* Announcing the activity could have failed, so check if we're actually
+   * announcing it */
+  if (!activity_is_announced (self))
+    return;
 
   g_object_unref (priv->group);
   priv->group = NULL;
-- 
1.5.6.5




More information about the Telepathy-commits mailing list