diff options
Diffstat (limited to 'swaybar/tray/tray.c')
-rw-r--r-- | swaybar/tray/tray.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/swaybar/tray/tray.c b/swaybar/tray/tray.c index 00f1a44f..91c3af06 100644 --- a/swaybar/tray/tray.c +++ b/swaybar/tray/tray.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE 500 +#define _XOPEN_SOURCE 700 #include <unistd.h> #include <stdlib.h> #include <string.h> @@ -90,13 +90,16 @@ static void get_items_reply(DBusPendingCall *pending, void *_data) { struct StatusNotifierItem *item = sni_create(name); - sway_log(L_DEBUG, "Item registered with host: %s", name); - list_add(tray->items, item); - dirty = true; + if (item) { + sway_log(L_DEBUG, "Item registered with host: %s", name); + list_add(tray->items, item); + dirty = true; + } } bail: dbus_message_unref(reply); + dbus_pending_call_unref(pending); return; } static void get_items() { @@ -141,8 +144,10 @@ static DBusHandlerResult signal_handler(DBusConnection *connection, if (list_seq_find(tray->items, sni_str_cmp, name) == -1) { struct StatusNotifierItem *item = sni_create(name); - list_add(tray->items, item); - dirty = true; + if (item) { + list_add(tray->items, item); + dirty = true; + } } return DBUS_HANDLER_RESULT_HANDLED; |