From 2c167b163f9eb55264eb74a4b1782c894de8e9a3 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Mon, 20 Mar 2023 16:15:41 -0500 Subject: [PATCH] If we get here with 0 resources to call, don't make the user pick one and then crash --- .../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 6edcf33492eb49f799cb9633bb3de31499e78a50..366d1fd60a55130fdc0c37d627b7278dd905331a 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 < 1) { + Toast.makeText(activity, "No online resources to call.", Toast.LENGTH_SHORT).show(); + } else if (resources.length == 1) { onFullJidSelected.onFullJidSelected(contact.getJid().withResource(resources[0])); } else { showPresenceSelectionDialog(activity, contact, resources, onFullJidSelected);