From c85b40e90e1fdba524632e93764a01cbf3875b7b Mon Sep 17 00:00:00 2001 From: Sascha Kruse Date: Tue, 17 Jul 2012 00:31:57 +0200 Subject: [PATCH] don't segfault on closeNotification with unknown id --- dunst.c | 2 +- dunst_dbus.c | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/dunst.c b/dunst.c index a5f13f7..c7d7185 100644 --- a/dunst.c +++ b/dunst.c @@ -757,7 +757,7 @@ int close_notification_by_id(int id, int reason) } } - if (reason > 0 && reason < 4) { + if (reason > 0 && reason < 4 && target != NULL) { notificationClosed(target, reason); } diff --git a/dunst_dbus.c b/dunst_dbus.c index 1e3ec51..a85e597 100644 --- a/dunst_dbus.c +++ b/dunst_dbus.c @@ -254,7 +254,13 @@ void notificationClosed(notification * n, int reason) { DBusMessage *dmsg; DBusMessageIter args; - int id = n->id; + int id; + + if (n == NULL) { + return; + } + + id = n->id; dmsg = dbus_message_new_signal("/org/freedesktop/Notifications",