Fix empty mailing lists

This commit is contained in:
Athozus 2024-03-24 17:38:54 +01:00
parent ccf07b50e2
commit 1dde4097f9
No known key found for this signature in database
GPG Key ID: B50895022E8484BF

View File

@ -346,6 +346,9 @@ function mail.get_maillist_by_name(playername, listname)
local entry = mail.get_storage_entry(playername) local entry = mail.get_storage_entry(playername)
for _, list in ipairs(entry.lists) do for _, list in ipairs(entry.lists) do
if list.name == listname then if list.name == listname then
if not list.players then
list.players = {}
end
return list return list
end end
end end
@ -362,6 +365,9 @@ function mail.update_maillist(playername, list, old_list_name)
end end
end end
-- insert -- insert
if not list.players then
list.players = {}
end
table.insert(entry.lists, list) table.insert(entry.lists, list)
mail.set_storage_entry(playername, entry) mail.set_storage_entry(playername, entry)
end end