feat(xep): Check for null nick before leaveRoom.

Signed-off-by: Ikjot Singh Dhody <ikjotsd@gmail.com>
This commit is contained in:
Ikjot Singh Dhody 2023-06-21 12:20:14 +05:30
parent e6bd6d05cd
commit a873edb9ec
2 changed files with 8 additions and 0 deletions

View File

@ -12,3 +12,8 @@ class InvalidDiscoInfoResponse extends MUCError {}
/// Returned when no nickname was specified from the client side while trying to /// Returned when no nickname was specified from the client side while trying to
/// perform some actions on the MUC, such as joining the room. /// perform some actions on the MUC, such as joining the room.
class NoNicknameSpecified extends MUCError {} class NoNicknameSpecified extends MUCError {}
/// This error occurs when a user attempts to perform an action that requires
/// them to be a member of a room, but they are not currently joined to
/// that room.
class RoomNotJoinedError extends MUCError {}

View File

@ -97,6 +97,9 @@ class MUCManager extends XmppManagerBase {
_mucRoomCache.remove(roomJid); _mucRoomCache.remove(roomJid);
return nick; return nick;
}); });
if (nick == null) {
return Result(RoomNotJoinedError);
}
await getAttributes().sendStanza( await getAttributes().sendStanza(
StanzaDetails( StanzaDetails(
Stanza.presence( Stanza.presence(