Changeset

5142:410d7c8d210d

mod_invites_api: Fix traceback on list command with no entries (thanks mirux)
author Matthew Wild <mwild1@gmail.com>
date Wed, 11 Jan 2023 09:59:55 +0000
parents 5141:027fb71ad509
children 5143:1cae382e88a1
files mod_invites_api/mod_invites_api.lua
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_invites_api/mod_invites_api.lua	Tue Jan 10 20:49:17 2023 +0100
+++ b/mod_invites_api/mod_invites_api.lua	Wed Jan 11 09:59:55 2023 +0000
@@ -120,7 +120,7 @@
 		api_key_store:set(nil, id, nil);
 	elseif command == "list" then
 		local api_key_store_kv = module:open_store("invite_api_keys");
-		for key_id, key_info in pairs(api_key_store_kv:get(nil)) do
+		for key_id, key_info in pairs(api_key_store_kv:get(nil) or {}) do
 			print(key_id, key_info.name or "<unknown>");
 		end
 	else