mod_admin_telnet: muc:*: Fix nil index error when a room JID is passed with a non-existent host
authorMatthew Wild <mwild1@gmail.com>
Sat, 05 Apr 2014 15:05:40 +0100
changeset 6064 c4a3222165c4
parent 6053 2f93a04564b2
child 6065 9ab23488a17c
mod_admin_telnet: muc:*: Fix nil index error when a room JID is passed with a non-existent host
plugins/mod_admin_telnet.lua
--- a/plugins/mod_admin_telnet.lua	Wed Apr 02 14:31:19 2014 +0100
+++ b/plugins/mod_admin_telnet.lua	Sat Apr 05 15:05:40 2014 +0100
@@ -942,6 +942,9 @@
 
 function def_env.muc:create(room_jid)
 	local room, host = check_muc(room_jid);
+	if not room_name then
+		return room_name, host;
+	end
 	if not room then return nil, host end
 	if hosts[host].modules.muc.rooms[room_jid] then return nil, "Room exists already" end
 	return hosts[host].modules.muc.create_room(room_jid);
@@ -949,6 +952,9 @@
 
 function def_env.muc:room(room_jid)
 	local room_name, host = check_muc(room_jid);
+	if not room_name then
+		return room_name, host;
+	end
 	local room_obj = hosts[host].modules.muc.rooms[room_jid];
 	if not room_obj then
 		return nil, "No such room: "..room_jid;