git » sdk » commit c40b0ef

Don't crash when resource not found

author Stephen Paul Weber
2023-11-20 19:31:33 UTC
committer Stephen Paul Weber
2023-11-20 19:31:33 UTC
parent dd5ee3da54003c61f7c7022121402ddff20ced84

Don't crash when resource not found

xmpp/Chat.hx +1 -1

diff --git a/xmpp/Chat.hx b/xmpp/Chat.hx
index 1ab0088..9240ce0 100644
--- a/xmpp/Chat.hx
+++ b/xmpp/Chat.hx
@@ -147,7 +147,7 @@ abstract class Chat {
 	}
 
 	public function getResourceCaps(resource:String):Caps {
-		return presence[resource].caps;
+		return presence[resource]?.caps ?? new Caps("", [], []);
 	}
 
 	public function setAvatarSha1(sha1: BytesData) {