Fix crash on revocation of removed privilege
authorrubenwardy <rw@rubenwardy.com>
Fri, 8 Sep 2017 22:45:56 +0000 (23:45 +0100)
committerrubenwardy <rw@rubenwardy.com>
Fri, 8 Sep 2017 22:45:56 +0000 (23:45 +0100)
builtin/game/register.lua

index e0073fc038a20a7c362d8eecb1a5d7d35d46b308..06c9c61d20b3495a4400ad1c52a476f45b08b545 100644 (file)
@@ -436,8 +436,9 @@ function core.run_callbacks(callbacks, mode, ...)
 end
 
 function core.run_priv_callbacks(name, priv, caller, method)
-       if not core.registered_privileges[priv]["on_" .. method] or
-                       not core.registered_privileges[priv]["on_" .. method](name, caller) then
+       local def = core.registered_privileges[priv]
+       if not def or not def["on_" .. method] or
+                       not def[priv]["on_" .. method](name, caller) then
                for _, func in ipairs(core["registered_on_priv_" .. method]) do
                        if not func(name, caller, priv) then
                                break