diff options
author | Waqas Hussain <waqas20@gmail.com> | 2009-10-18 18:10:05 +0500 |
---|---|---|
committer | Waqas Hussain <waqas20@gmail.com> | 2009-10-18 18:10:05 +0500 |
commit | dd1e1f3980575ab8878283d307e61919d2520cea (patch) | |
tree | 163586ea438f8aebbb0e60936ffcaf38caa23529 | |
parent | 09d59fbf6b67d531594a50ae328bca3ce1119eb1 (diff) | |
download | prosody-dd1e1f3980575ab8878283d307e61919d2520cea.tar.gz prosody-dd1e1f3980575ab8878283d307e61919d2520cea.zip |
mod_console: Fixed traceback occuring on using module:list on unknown hosts.
-rw-r--r-- | plugins/mod_console.lua | 8 |
1 files changed, 6 insertions, 2 deletions
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); |