Skip to content

Commit 8a0a24e

Browse files
committed
Update XmlUtil.java
Null check for the child
1 parent bf93f9d commit 8a0a24e

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)