naughty: Fix getting a notification by id.

There is more into that table than just screens. If `get_by_id` was
called with an invalid notification (or a "future" one in case of
suspended / do_not_disturb), it would explode.
This commit is contained in:
Emmanuel Lepage Vallee 2021-10-05 12:55:01 -07:00
parent f81723733c
commit 0d1e977917
1 changed files with 2 additions and 2 deletions

View File

@ -394,8 +394,8 @@ end
-- @staticfct naughty.get_by_id
function naughty.get_by_id(id)
-- iterate the notifications to get the notfications with the correct ID
for s in pairs(naughty.notifications) do
for p in pairs(naughty.notifications[s]) do
for s in capi.screen do
for p in pairs(naughty.notifications[s] or {}) do
for _, notification in pairs(naughty.notifications[s][p]) do
if notification.id == id then
return notification