From bcc0c32af3277a5628264fd96efca64d389c7080 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Thu, 18 Jan 2024 13:16:14 +0100 Subject: [PATCH] fix crash when using direct jingle init on offline contacts --- .../eu/siacs/conversations/ui/util/PresenceSelector.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/siacs/conversations/ui/util/PresenceSelector.java b/src/main/java/eu/siacs/conversations/ui/util/PresenceSelector.java index 6edcf3349..d9cda665a 100644 --- a/src/main/java/eu/siacs/conversations/ui/util/PresenceSelector.java +++ b/src/main/java/eu/siacs/conversations/ui/util/PresenceSelector.java @@ -32,6 +32,7 @@ package eu.siacs.conversations.ui.util; import android.app.Activity; import android.content.Context; import android.util.Pair; +import android.widget.Toast; import androidx.appcompat.app.AlertDialog; @@ -60,7 +61,9 @@ public class PresenceSelector { public static void selectFullJidForDirectRtpConnection(final Activity activity, final Contact contact, final RtpCapability.Capability required, final OnFullJidSelected onFullJidSelected) { final String[] resources = RtpCapability.filterPresences(contact, required); - if (resources.length == 1) { + if (resources.length == 0) { + Toast.makeText(activity,R.string.rtp_state_contact_offline,Toast.LENGTH_LONG).show(); + } else if (resources.length == 1) { onFullJidSelected.onFullJidSelected(contact.getJid().withResource(resources[0])); } else { showPresenceSelectionDialog(activity, contact, resources, onFullJidSelected);