From dd1e1f3980575ab8878283d307e61919d2520cea Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Sun, 18 Oct 2009 18:10:05 +0500 Subject: mod_console: Fixed traceback occuring on using module:list on unknown hosts. --- plugins/mod_console.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/mod_console.lua b/plugins/mod_console.lua index 19c22c91..a46eec12 100644 --- a/plugins/mod_console.lua +++ b/plugins/mod_console.lua @@ -345,9 +345,13 @@ function def_env.module:list(hosts) local print = self.session.print; for _, host in ipairs(hosts) do print(host..":"); - local modules = array.collect(keys(prosody.hosts[host].modules or {})):sort(); + local modules = array.collect(keys(prosody.hosts[host] and prosody.hosts[host].modules or {})):sort(); if #modules == 0 then - print(" No modules loaded"); + if prosody.hosts[host] then + print(" No modules loaded"); + else + print(" Host not found"); + end else for _, name in ipairs(modules) do print(" "..name); -- cgit v1.2.3