changeset 248:db1b4c6089b6

mod_adhoc_cmd_admin: Check if announcement fields are filled (Thanks Zash)
author Florian Zeitz <florob@babelmonkeys.de>
date Thu, 26 Aug 2010 22:59:45 +0200
parents fbddb9db1c82
children 50c4348c2494
files mod_adhoc_cmd_admin/mod_adhoc_cmd_admin.lua
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mod_adhoc_cmd_admin/mod_adhoc_cmd_admin.lua	Tue Aug 24 18:53:05 2010 +0200
+++ b/mod_adhoc_cmd_admin/mod_adhoc_cmd_admin.lua	Thu Aug 26 22:59:45 2010 +0200
@@ -446,7 +446,7 @@
 
 		local fields = announce_layout:data(data.form);
 
-		if #fields.announcement == 0 then
+		if (not fields.announcement) or (#fields.announcement == 0)  then
 			return { status = "completed", error = { message = "Please specify some announcement text." } };
 		end
 
@@ -473,7 +473,7 @@
 
 		local fields = shut_down_service_layout:data(data.form);
 
-		if #fields.announcement > 0 then
+		if fields.announcement and #fields.announcement > 0 then
 			local message = st.message({type = "headline"}, fields.announcement):up()
 				:tag("subject"):text("Server is shutting down");
 			send_to_online(message);