changeset 546:0afe88f9bdde

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)
author Marco Cirillo <maranda@lightwitch.org>
date Tue, 10 Jan 2012 20:55:45 +0000 (2012-01-10)
parents 77f350635f4f
children f0ef6e285d69
files mod_server_status/mod_server_status.lua
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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