From 5cac4397ddc7a4c01a2811c4a4a1c2245d1a14f2 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Mon, 3 Jul 2017 19:44:01 +0200 Subject: [PATCH] catch state changing error when sending timeout to iq callbacks --- .../eu/siacs/conversations/xmpp/XmppConnection.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java index 303171240..a07fad235 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java @@ -1086,7 +1086,12 @@ public class XmppConnection implements Runnable { } } for(OnIqPacketReceived callback : callbacks) { - callback.onIqPacketReceived(account,failurePacket); + try { + callback.onIqPacketReceived(account, failurePacket); + } catch (StateChangingError error) { + Log.d(Config.LOGTAG,account.getJid().toBareJid()+": caught StateChangingError("+error.state.toString()+") while clearing callbacks"); + //ignore + } } Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": done clearing iq callbacks. " + this.packetCallbacks.size() + " left"); } @@ -1322,8 +1327,7 @@ public class XmppConnection implements Runnable { public synchronized String sendUnmodifiedIqPacket(final IqPacket packet, final OnIqPacketReceived callback) { if (packet.getId() == null) { - final String id = nextRandomId(); - packet.setAttribute("id", id); + packet.setAttribute("id", nextRandomId()); } if (callback != null) { synchronized (this.packetCallbacks) {