Skip to content

Commit f35ce05

Browse files
authored
Merge pull request #199 from splunk/null-check-for-child
Update XmlUtil.java
2 parents bf93f9d + 8a0a24e commit f35ce05

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

splunk/src/main/java/com/splunk/modularinput/XmlUtil.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,12 @@ class XmlUtil {
3535
*/
3636
static String textInNode(Node node, String errorMessage) throws MalformedDataException {
3737
Node child = node.getFirstChild();
38-
if (child.getNodeType() != Node.TEXT_NODE) {
38+
if (null == child) {
39+
return "";
40+
} else if (child.getNodeType() != Node.TEXT_NODE) {
3941
throw new MalformedDataException(errorMessage);
4042
} else {
41-
return ((Text)child).getData();
43+
return ((Text) child).getData();
4244
}
4345
}
4446

0 commit comments

Comments
 (0)