mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-22 23:42:59 +00:00
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:
parent
8a2c26d395
commit
6ef17fed27
1 changed files with 2 additions and 2 deletions
|
@ -137,7 +137,7 @@ end
|
||||||
-- @param number > 1 time The number of seconds to suppress notifications for.
|
-- @param number > 1 time The number of seconds to suppress notifications for.
|
||||||
-- number < 1 immediately removes the suppression.
|
-- number < 1 immediately removes the suppression.
|
||||||
function Notify.suppress_for_player(name, time)
|
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 the player is already suppressed, cancel it unless it's a function
|
||||||
if not check_clear_suppressed(name, suppress) then return false end
|
if not check_clear_suppressed(name, suppress) then return false end
|
||||||
if time < 1 then return end
|
if time < 1 then return end
|
||||||
|
@ -149,7 +149,7 @@ end
|
||||||
|
|
||||||
--- Suppress a player's notifications while function executes.
|
--- Suppress a player's notifications while function executes.
|
||||||
function Notify.suppress_for_function(name, func)
|
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 the player is already suppressed, cancel it unless it's a function
|
||||||
if not check_clear_suppressed(name, suppress) then return false end
|
if not check_clear_suppressed(name, suppress) then return false end
|
||||||
suppress[name] = func
|
suppress[name] = func
|
||||||
|
|
Loading…
Reference in a new issue