From 3f872ddc9f56255ac090260ec720b04a523cf695 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sun, 6 Apr 2014 15:22:56 +0200 Subject: [PATCH] fixed npe --- src/eu/siacs/conversations/xml/TagWriter.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/eu/siacs/conversations/xml/TagWriter.java b/src/eu/siacs/conversations/xml/TagWriter.java index d945b47b5..40d5b3289 100644 --- a/src/eu/siacs/conversations/xml/TagWriter.java +++ b/src/eu/siacs/conversations/xml/TagWriter.java @@ -47,18 +47,27 @@ public class TagWriter { } public TagWriter beginDocument() throws IOException { + if (outputStream==null) { + throw new IOException("output stream was null"); + } outputStream.write(""); outputStream.flush(); return this; } public TagWriter writeTag(Tag tag) throws IOException { + if (outputStream==null) { + throw new IOException("output stream was null"); + } outputStream.write(tag.toString()); outputStream.flush(); return this; } public TagWriter writeElement(Element element) throws IOException { + if (outputStream==null) { + throw new IOException("output stream was null"); + } outputStream.write(element.toString()); outputStream.flush(); return this;