mod_audit_status: Fix error on first start
Fixes 'attempt to index a nil value' the first time this module is
loaded, since there's no data yet.
--- a/mod_audit_status/mod_audit_status.lua Mon Apr 17 14:31:50 2023 +0100
+++ b/mod_audit_status/mod_audit_status.lua Tue Apr 18 21:48:31 2023 +0200
@@ -11,7 +11,7 @@
module:hook_global("server-started", function ()
local recorded_status = store:get();
- if recorded_status.status == "started" then
+ if recorded_status and recorded_status.status == "started" then
module:audit(nil, "server-crashed", { timestamp = recorded_status.heartbeat });
end
module:audit(nil, "server-started");