wraped stanza writer in try catch

iNPUTmice created

Change summary

src/eu/siacs/conversations/xml/TagWriter.java | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)

Detailed changes

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;
 		}
 	}