From cfd1af88eb7c28c2b455db08a11cc5c783a6422e Mon Sep 17 00:00:00 2001 From: nicoco Date: Sun, 6 Nov 2022 08:12:37 +0100 Subject: [PATCH] fix crash on adhoc command with bad clients If a command has no "next" handler, slixmpp crashes if a client acts as if there was a next step. This raises an XMPPError instead --- slixmpp/plugins/xep_0050/adhoc.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/slixmpp/plugins/xep_0050/adhoc.py b/slixmpp/plugins/xep_0050/adhoc.py index 072ec5aa..b101056e 100644 --- a/slixmpp/plugins/xep_0050/adhoc.py +++ b/slixmpp/plugins/xep_0050/adhoc.py @@ -620,6 +620,8 @@ class XEP_0050(BasePlugin): async def _await_if_needed(handler, *args): + if handler is None: + raise XMPPError("bad-request", text="The command is completed") if asyncio.iscoroutinefunction(handler): log.debug(f"%s is async", handler) return await handler(*args)