[Telepathy] [PATCH] Geoclue: check for errors, validity and bail when setting up

Niv Sardi xaiki at debian.org
Thu Jun 18 01:28:51 PDT 2009


in setup_geoclue:libempathy-gtk/empathy-location-manager.c we call
geoclue_master_create_client () without checking it actually returns
anything or giving it a GError pointer.

Add the check and the use of error.

Signed-off-by: Niv Sardi <xaiki at debian.org>
---
 libempathy-gtk/empathy-location-manager.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/libempathy-gtk/empathy-location-manager.c b/libempathy-gtk/empathy-location-manager.c
index 2e45ab6..492704e 100644
--- a/libempathy-gtk/empathy-location-manager.c
+++ b/libempathy-gtk/empathy-location-manager.c
@@ -482,9 +482,16 @@ setup_geoclue (EmpathyLocationManager *location_manager)
 
   DEBUG ("Setting up Geoclue");
   master = geoclue_master_get_default ();
-  priv->gc_client = geoclue_master_create_client (master, NULL, NULL);
+  priv->gc_client = geoclue_master_create_client (master, NULL, &error);
   g_object_unref (master);
 
+  if (! priv->gc_client)
+    {
+       DEBUG("Failed to acquire GeoClue client: %s", error->message);
+       g_error_free (error);
+       return;
+    }
+
   update_resources (location_manager);
 
   /* Get updated when the position is changes */
-- 
1.6.3.1



More information about the telepathy mailing list