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
This commit is contained in:
nicoco 2022-11-06 08:12:37 +01:00
parent 7a0fb97083
commit cfd1af88eb

View file

@ -620,6 +620,8 @@ class XEP_0050(BasePlugin):
async def _await_if_needed(handler, *args): async def _await_if_needed(handler, *args):
if handler is None:
raise XMPPError("bad-request", text="The command is completed")
if asyncio.iscoroutinefunction(handler): if asyncio.iscoroutinefunction(handler):
log.debug(f"%s is async", handler) log.debug(f"%s is async", handler)
return await handler(*args) return await handler(*args)