aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcharles kerr <charlesk@canonical.com>2016-01-01 20:19:45 -0600
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2021-08-28 10:17:14 +0200
commit5d038638f58765ec3859797704c5d0e1c0fa7903 (patch)
tree233c74a9d8eb05951244996e54e2e9d734dc5ff9 /src
parentdeca915372eddd1e0a1fa219cb26d7f6541d1f80 (diff)
downloadayatana-indicator-power-5d038638f58765ec3859797704c5d0e1c0fa7903.tar.gz
ayatana-indicator-power-5d038638f58765ec3859797704c5d0e1c0fa7903.tar.bz2
ayatana-indicator-power-5d038638f58765ec3859797704c5d0e1c0fa7903.zip
handle service_set_notifier(NULL) gracefully
Diffstat (limited to 'src')
-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);
}