more npe fixes

iNPUTmice created

Change summary

src/eu/siacs/conversations/xml/Tag.java       | 2 ++
src/eu/siacs/conversations/xml/XmlReader.java | 9 ++++++---
2 files changed, 8 insertions(+), 3 deletions(-)

Detailed changes

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));
 	}
 	

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()) {