eds: Don’t try and remove a non-existent timeout source
authorPhilip Withnall <philip@tecnocode.co.uk>
Tue, 17 Apr 2012 11:56:11 +0000 (12:56 +0100)
committerPhilip Withnall <philip@tecnocode.co.uk>
Tue, 17 Apr 2012 15:08:21 +0000 (16:08 +0100)
In the case that the modify_contact() call fails, timeout_id will equal 0,
and GLib will complain when we try to remove it in the finally{} block.

backends/eds/lib/edsf-persona-store.vala

index 1ac7da3..4fa5b97 100644 (file)
@@ -1261,8 +1261,15 @@ public class Edsf.PersonaStore : Folks.PersonaStore
       finally
         {
           /* Remove the callbacks. */
-          persona.disconnect (signal_id);
-          GLib.Source.remove (timeout_id);
+          if (signal_id != 0)
+            {
+              persona.disconnect (signal_id);
+            }
+
+          if (timeout_id != 0)
+            {
+              GLib.Source.remove (timeout_id);
+            }
         }
     }