do not return NodeHash if no valid hash mech is found

This commit is contained in:
Daniel Gultsch 2023-01-19 19:45:48 +01:00
parent f5faa8fc4d
commit 09db9e574b
No known key found for this signature in database
GPG key ID: F43D18AD2A0982C2

View file

@ -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;
}