diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2014-05-14 18:39:59 +0200 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2014-05-14 18:39:59 +0200 |
commit | 08a26d27727bc723d638a60fa5589fa9e90b6af7 (patch) | |
tree | fe47df878ae0498eb23f7b8f9018c38a39e646b0 /src | |
parent | f4eebd091ce3be0e429c2f5ea9de292317d7d8a6 (diff) |
fixed possible npe
Diffstat (limited to '')
-rw-r--r-- | src/eu/siacs/conversations/xml/XmlReader.java | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/eu/siacs/conversations/xml/XmlReader.java b/src/eu/siacs/conversations/xml/XmlReader.java index 0a82a5d8..b4b1647e 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; } } |