core/notify: fix crash in suppression system

`local globalstate` is initialised to have the field `suppressed_players`, but the non-existent field `suppress` is requested, resulting in operations on nil rather than the expected table. This causes the aforementioned crash.

This commit fixes this issue.
This commit is contained in:
Starbeamrainbowlabs 2024-10-17 02:25:31 +01:00
parent 8a2c26d395
commit 6ef17fed27
No known key found for this signature in database
GPG Key ID: 1BE5172E637709C2

@ -137,7 +137,7 @@ end
-- @param number > 1 time The number of seconds to suppress notifications for.
-- number < 1 immediately removes the suppression.
function Notify.suppress_for_player(name, time)
local suppress = globalstate.suppress
local suppress = globalstate.suppressed_players
-- If the player is already suppressed, cancel it unless it's a function
if not check_clear_suppressed(name, suppress) then return false end
if time < 1 then return end
@ -149,7 +149,7 @@ end
--- Suppress a player's notifications while function executes.
function Notify.suppress_for_function(name, func)
local suppress = globalstate.suppress
local suppress = globalstate.suppressed_players
-- If the player is already suppressed, cancel it unless it's a function
if not check_clear_suppressed(name, suppress) then return false end
suppress[name] = func