From 08a26d27727bc723d638a60fa5589fa9e90b6af7 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Wed, 14 May 2014 18:39:59 +0200 Subject: fixed possible npe --- src/eu/siacs/conversations/xml/XmlReader.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/eu/siacs/conversations') diff --git a/src/eu/siacs/conversations/xml/XmlReader.java b/src/eu/siacs/conversations/xml/XmlReader.java index 0a82a5d89..b4b1647ef 100644 --- a/src/eu/siacs/conversations/xml/XmlReader.java +++ b/src/eu/siacs/conversations/xml/XmlReader.java @@ -85,10 +85,8 @@ public class XmlReader { public Element readElement(Tag currentTag) throws XmlPullParserException, IOException { Element element = new Element(currentTag.getName()); - //Log.d(LOGTAG,"trying to read element "+element.getName()); element.setAttributes(currentTag.getAttributes()); Tag nextTag = this.readTag(); - //Log.d(LOGTAG,"next Tag is: "+nextTag.toString()); if(nextTag.isNo()) { element.setContent(nextTag.getName()); nextTag = this.readTag(); @@ -96,15 +94,16 @@ public class XmlReader { if (nextTag == null) { throw new IOException("unterupted mid tag"); } - //Log.d(LOGTAG,"reading till the end of "+element.getName()); while(!nextTag.isEnd(element.getName())) { if (!nextTag.isNo()) { Element child = this.readElement(nextTag); element.addChild(child); } nextTag = this.readTag(); + if (nextTag == null) { + throw new IOException("unterupted mid tag"); + } } - //Log.d(LOGTAG,"return with element"+element); return element; } } -- cgit v1.2.3