aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel.gultsch@rwth-aachen.de>2014-04-03 15:08:53 +0200
committerDaniel Gultsch <daniel.gultsch@rwth-aachen.de>2014-04-03 15:08:53 +0200
commit217d18b6acb153e83b23aadd9674b85bc741e4cb (patch)
tree42f42d960d16b26021ed9038d6999be12dee03e8
parent9d2d853e1b3b1f167be16ffe53530cbe83790ad1 (diff)
fixed null pointer
-rw-r--r--src/eu/siacs/conversations/xml/TagWriter.java4
-rw-r--r--src/eu/siacs/conversations/xmpp/XmppConnection.java13
2 files changed, 12 insertions, 5 deletions
diff --git a/src/eu/siacs/conversations/xml/TagWriter.java b/src/eu/siacs/conversations/xml/TagWriter.java
index c8294aed..f06664fd 100644
--- a/src/eu/siacs/conversations/xml/TagWriter.java
+++ b/src/eu/siacs/conversations/xml/TagWriter.java
@@ -75,4 +75,8 @@ public class TagWriter {
public boolean finished() {
return (this.writeQueue.size() == 0);
}
+
+ public boolean isActive() {
+ return outputStream != null;
+ }
}
diff --git a/src/eu/siacs/conversations/xmpp/XmppConnection.java b/src/eu/siacs/conversations/xmpp/XmppConnection.java
index e50ccd05..582bf9bd 100644
--- a/src/eu/siacs/conversations/xmpp/XmppConnection.java
+++ b/src/eu/siacs/conversations/xmpp/XmppConnection.java
@@ -678,6 +678,7 @@ public class XmppConnection implements Runnable {
public void sendIqPacket(IqPacket packet, OnIqPacketReceived callback) {
String id = nextRandomId();
packet.setAttribute("id", id);
+ packet.setFrom(account.getFullJid());
this.sendPacket(packet, callback);
}
@@ -761,12 +762,14 @@ public class XmppConnection implements Runnable {
socket.close();
return;
}
- tagWriter.finish();
- while(!tagWriter.finished()) {
- //Log.d(LOGTAG,"not yet finished");
- Thread.sleep(100);
+ if (tagWriter.isActive()) {
+ tagWriter.finish();
+ while(!tagWriter.finished()) {
+ //Log.d(LOGTAG,"not yet finished");
+ Thread.sleep(100);
+ }
+ tagWriter.writeTag(Tag.end("stream:stream"));
}
- tagWriter.writeTag(Tag.end("stream:stream"));
} catch (IOException e) {
Log.d(LOGTAG,"io exception during disconnect");
} catch (InterruptedException e) {