diff options
-rw-r--r-- | src/eu/siacs/conversations/xml/TagWriter.java | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/eu/siacs/conversations/xml/TagWriter.java b/src/eu/siacs/conversations/xml/TagWriter.java index ef1e8555..95436f05 100644 --- a/src/eu/siacs/conversations/xml/TagWriter.java +++ b/src/eu/siacs/conversations/xml/TagWriter.java @@ -78,11 +78,17 @@ public class TagWriter { } public TagWriter writeStanzaAsync(AbstractStanza stanza) { - if (finshed) { - return this; - } else { - if (!asyncStanzaWriter.isAlive()) asyncStanzaWriter.start(); - writeQueue.add(stanza); + try { + if (finshed) { + return this; + } else { + if (!asyncStanzaWriter.isAlive()) { + asyncStanzaWriter.start(); + } + writeQueue.add(stanza); + return this; + } + } catch (IllegalThreadStateException e) { return this; } } |