aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-06-25 17:54:00 +0200
committeriNPUTmice <daniel@gultsch.de>2014-06-25 17:54:00 +0200
commit66bb5c9b51d8da72e0799707ba95d83da4f419b5 (patch)
treef25f471e6736367dc79f5b32675fcdf31ecc0e2c
parent5db04a37bd5b7acc41a8f2dad941fabd9a6a97e8 (diff)
more npe fixes
-rw-r--r--src/eu/siacs/conversations/xml/Tag.java2
-rw-r--r--src/eu/siacs/conversations/xml/XmlReader.java9
2 files changed, 8 insertions, 3 deletions
diff --git a/src/eu/siacs/conversations/xml/Tag.java b/src/eu/siacs/conversations/xml/Tag.java
index 7055e2b39..2d5ffdbc0 100644
--- a/src/eu/siacs/conversations/xml/Tag.java
+++ b/src/eu/siacs/conversations/xml/Tag.java
@@ -56,10 +56,12 @@ public class Tag {
}
public boolean isStart(String needle) {
+ if (needle==null) return false;
return (this.type == START) && (needle.equals(this.name));
}
public boolean isEnd(String needle) {
+ if (needle==null) return false;
return (this.type == END) && (needle.equals(this.name));
}
diff --git a/src/eu/siacs/conversations/xml/XmlReader.java b/src/eu/siacs/conversations/xml/XmlReader.java
index 4c418027d..98bee3eef 100644
--- a/src/eu/siacs/conversations/xml/XmlReader.java
+++ b/src/eu/siacs/conversations/xml/XmlReader.java
@@ -89,12 +89,15 @@ public class XmlReader {
Element element = new Element(currentTag.getName());
element.setAttributes(currentTag.getAttributes());
Tag nextTag = this.readTag();
+ if (nextTag == null) {
+ throw new IOException("unterupted mid tag");
+ }
if(nextTag.isNo()) {
element.setContent(nextTag.getName());
nextTag = this.readTag();
- }
- if (nextTag == null) {
- throw new IOException("unterupted mid tag");
+ if (nextTag == null) {
+ throw new IOException("unterupted mid tag");
+ }
}
while(!nextTag.isEnd(element.getName())) {
if (!nextTag.isNo()) {