# HG changeset patch
# User Kim Alvefur <zash@zash.se>
# Date 1577140124 -3600
# Node ID 40c2500208f47478e49de1d407cfadc22e0ee07c
# Parent  e1cb869e2f6c087ff149988bc5d9f8f73d33d71b
mod_muc_mam: Handle form identification error (e.g. not a form at all)

diff -r e1cb869e2f6c -r 40c2500208f4 plugins/mod_muc_mam.lua
--- a/plugins/mod_muc_mam.lua	Mon Dec 23 23:11:28 2019 +0100
+++ b/plugins/mod_muc_mam.lua	Mon Dec 23 23:28:44 2019 +0100
@@ -145,7 +145,10 @@
 	local form = query:get_child("x", "jabber:x:data");
 	if form then
 		local form_type, err = get_form_type(form);
-		if form_type ~= xmlns_mam then
+		if not form_type then
+			origin.send(st.error_reply(stanza, "modify", "bad-request", "Invalid dataform: "..err));
+			return true;
+		elseif form_type ~= xmlns_mam then
 			origin.send(st.error_reply(stanza, "modify", "bad-request", "Unexpected FORM_TYPE, expected '"..xmlns_mam.."'"));
 			return true;
 		end