aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/service.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/service.c b/src/service.c
index 17414c7..c04122f 100644
--- a/src/service.c
+++ b/src/service.c
@@ -1339,9 +1339,13 @@ indicator_power_service_set_notifier (IndicatorPowerService * self,
g_return_if_fail (!notifier || INDICATOR_IS_POWER_NOTIFIER (notifier));
p = self->priv;
- if (p->notifier != notifier)
+ if (p->notifier == notifier)
+ return;
+
+ g_clear_object (&p->notifier);
+
+ if (notifier != NULL)
{
- g_clear_object (&p->notifier);
p->notifier = g_object_ref (notifier);
indicator_power_notifier_set_bus (p->notifier, p->conn);
}