mod_server_status: fixed trace case when an user, mistakenly or not, sets a component which doesn't exist into the plugin config. (thanks chris)
--- a/mod_server_status/mod_server_status.lua Tue Jan 10 21:17:13 2012 +0100
+++ b/mod_server_status/mod_server_status.lua Tue Jan 10 20:55:45 2012 +0000
@@ -75,7 +75,7 @@
comps_stats[1] = response_table.comps.elem_header
for _, name in ipairs(components) do
comps_stats[#comps_stats+1] = response_table.comps.status:format(
- name, hosts[name].modules.component and hosts[name].modules.component.connected and "online" or
+ name, hosts[name] and hosts[name].modules.component and hosts[name].modules.component.connected and "online" or
hosts[name] and hosts[name].modules.component == nil and "online" or "offline")
end
comps_stats[#comps_stats+1] = response_table.comps.elem_closure
@@ -101,7 +101,7 @@
if show_comps then
result.components = {}
for _,n in ipairs(show_comps) do
- result.components[n] = hosts[n].modules.component and hosts[n].modules.component.connected and "online" or
+ result.components[n] = hosts[n] and hosts[n].modules.component and hosts[n].modules.component.connected and "online" or
hosts[n] and hosts[n].modules.component == nil and "online" or "offline"
end
end