GUAC-969: Fix possible NPE in XML parsing.

This commit is contained in:
Michael Jumper
2014-12-27 14:14:37 -08:00
parent 46fd8119b9
commit 473a0fd35d

View File

@@ -140,8 +140,13 @@ public class DocumentHandler extends DefaultHandler {
public void characters(char[] ch, int start, int length) public void characters(char[] ch, int start, int length)
throws SAXException { throws SAXException {
// Get current state
DocumentHandlerState current = getCurrentState();
if (current == null)
throw new SAXException("Character data not allowed outside XML document.");
// Append received chunk to text content // Append received chunk to text content
getCurrentState().getTextContent().append(ch, start, length); current.getTextContent().append(ch, start, length);
} }