changeset 4580:785389a2d2b3

mod_muc_dicebot: ignore messages without body
author Jonas Schäfer <jonas@wielicki.name>
date Sat, 29 May 2021 15:34:41 +0200
parents b305814bd930
children 3e2e708fd18b
files mod_muc_dicebot/mod_muc_dicebot.lua
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mod_muc_dicebot/mod_muc_dicebot.lua	Sat May 29 15:17:05 2021 +0200
+++ b/mod_muc_dicebot/mod_muc_dicebot.lua	Sat May 29 15:34:41 2021 +0200
@@ -37,6 +37,10 @@
 
 	local stanza = event.stanza;
 	local body = stanza:get_child("body");
+	if not body then
+		return
+	end
+
 	local text = body:get_text();
 	module:log("error", "%q %q %q", stanza, body, text);
 	local dice = s_match(text, "^[%.!]r%s(.+)$");