fixed possible npe

This commit is contained in:
Daniel Gultsch 2014-05-23 10:15:58 +02:00
parent a5d54d70ee
commit 8133dcd881
1 changed files with 6 additions and 0 deletions

View File

@ -330,6 +330,9 @@ public class XmppConnection implements Runnable {
} }
element.setAttributes(currentTag.getAttributes()); element.setAttributes(currentTag.getAttributes());
Tag nextTag = tagReader.readTag(); Tag nextTag = tagReader.readTag();
if (nextTag==null) {
throw new IOException("interrupted mid tag");
}
while (!nextTag.isEnd(element.getName())) { while (!nextTag.isEnd(element.getName())) {
if (!nextTag.isNo()) { if (!nextTag.isNo()) {
Element child = tagReader.readElement(nextTag); Element child = tagReader.readElement(nextTag);
@ -341,6 +344,9 @@ public class XmppConnection implements Runnable {
element.addChild(child); element.addChild(child);
} }
nextTag = tagReader.readTag(); nextTag = tagReader.readTag();
if (nextTag==null) {
throw new IOException("interrupted mid tag");
}
} }
++stanzasReceived; ++stanzasReceived;
lastPaketReceived = SystemClock.elapsedRealtime(); lastPaketReceived = SystemClock.elapsedRealtime();