From 09db9e574b78fe663eeca47afdb4fef4371083b6 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Thu, 19 Jan 2023 19:45:48 +0100 Subject: [PATCH] do not return NodeHash if no valid hash mech is found --- .../android/xmpp/model/capabilties/EntityCapabilities.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/im/conversations/android/xmpp/model/capabilties/EntityCapabilities.java b/src/main/java/im/conversations/android/xmpp/model/capabilties/EntityCapabilities.java index b55f64bc7..f8ed4ef66 100644 --- a/src/main/java/im/conversations/android/xmpp/model/capabilties/EntityCapabilities.java +++ b/src/main/java/im/conversations/android/xmpp/model/capabilties/EntityCapabilities.java @@ -1,5 +1,7 @@ package im.conversations.android.xmpp.model.capabilties; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import im.conversations.android.xmpp.model.Extension; public interface EntityCapabilities { @@ -20,7 +22,7 @@ public interface EntityCapabilities { } else { return null; } - return new NodeHash(node, hash); + return hash == null ? null : new NodeHash(node, hash); } class NodeHash { @@ -28,7 +30,8 @@ public interface EntityCapabilities { public final im.conversations.android.xmpp.EntityCapabilities.Hash hash; private NodeHash( - String node, final im.conversations.android.xmpp.EntityCapabilities.Hash hash) { + @Nullable String node, + @NonNull final im.conversations.android.xmpp.EntityCapabilities.Hash hash) { this.node = node; this.hash = hash; }