From ee7d4f9fa48146d435a2c4f72b5712d15878a27e Mon Sep 17 00:00:00 2001 From: Arne Date: Mon, 8 May 2023 18:17:24 +0200 Subject: [PATCH] show params still for nice xmpp uri (Stephen Paul Weber) --- .../eu/siacs/conversations/ui/util/MyLinkify.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/util/MyLinkify.java b/src/main/java/eu/siacs/conversations/ui/util/MyLinkify.java index 48fd57704..a60e1ee15 100644 --- a/src/main/java/eu/siacs/conversations/ui/util/MyLinkify.java +++ b/src/main/java/eu/siacs/conversations/ui/util/MyLinkify.java @@ -397,12 +397,12 @@ public class MyLinkify { for (final URLSpan urlspan : body.getSpans(0, body.length() - 1, URLSpan.class)) { Uri uri = Uri.parse(urlspan.getURL()); if ("xmpp".equals(uri.getScheme())) { - if (!body.subSequence(body.getSpanStart(urlspan), body.getSpanEnd(urlspan)).toString().startsWith("xmpp:")) { - // Already customized - continue; - } - try { + if (!body.subSequence(body.getSpanStart(urlspan), body.getSpanEnd(urlspan)).toString().startsWith("xmpp:")) { + // Already customized + continue; + } + XmppUri xmppUri = new XmppUri(uri); Jid jid = xmppUri.getJid(); String display = xmppUri.toString(); @@ -420,7 +420,7 @@ public class MyLinkify { body.getSpanEnd(urlspan), display ); - } catch (final IllegalArgumentException e) { /* bad JID */ } + } catch (final IllegalArgumentException | IndexOutOfBoundsException e) { /* bad JID or span gone */ } } } }