# HG changeset patch # User Emmanuel Gil Peyrot # Date 1577659292 -3600 # Node ID 58e484426d136cfcde2a87ccf2cec7a7976880c0 # Parent 6273705e3830d93cc87a20280c2e17d4c4b5fbdc mod_nodeinfo2: Fix traceback on non-existing data diff -r 6273705e3830 -r 58e484426d13 mod_nodeinfo2/mod_nodeinfo2.lua --- a/mod_nodeinfo2/mod_nodeinfo2.lua Sun Dec 29 22:09:58 2019 +0100 +++ b/mod_nodeinfo2/mod_nodeinfo2.lua Sun Dec 29 23:41:32 2019 +0100 @@ -38,7 +38,7 @@ week_users = nil; end -local data = main_store:get("nodeinfo2"); +local data = main_store:get("nodeinfo2") or { message_count = 0 }; module:provides("http", { default_path = "/.well-known/x-nodeinfo2"; @@ -48,7 +48,7 @@ for stat, _ in pairs(stats) do if stat == "/"..module.host.."/mod_measure_message_e2ee/message:rate" then local new_message_count = extras[stat].total; - if not data or new_message_count ~= data.message_count then + if new_message_count ~= data.message_count then data = { message_count = new_message_count }; main_store:set("nodeinfo2", data); end