Skip to content

Commit

Permalink
Added Null Check (Issue #376)
Browse files Browse the repository at this point in the history
  • Loading branch information
rsoika committed Feb 7, 2025
1 parent 72f8ebf commit c770a64
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1166,7 +1166,8 @@ public Element findExtensionElement(Element element, String namespace, String el
NodeList childs = extensionElement.getChildNodes();
for (int i = 0; i < childs.getLength(); i++) {
Node childNode = childs.item(i);
if (childNode.getNodeType() == Node.ELEMENT_NODE && tagName.equals(childNode.getNodeName())) {
if (childNode != null && childNode.getNodeType() == Node.ELEMENT_NODE
&& tagName.equals(childNode.getNodeName())) {
autoAlignElement = (Element) childNode;
break;
}
Expand Down Expand Up @@ -1461,8 +1462,8 @@ public Set<Element> findChildNodesByName(Element parent, BPMNNS ns, String nodeN
NodeList childs = parent.getChildNodes();
for (int i = 0; i < childs.getLength(); i++) {
Node childNode = childs.item(i);

if (childNode.getNodeType() == Node.ELEMENT_NODE && tagName.equals(childNode.getNodeName())) {
if (childNode != null && childNode.getNodeType() == Node.ELEMENT_NODE
&& tagName.equals(childNode.getNodeName())) {
result.add((Element) childNode);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,8 @@ public void deleteChildNodesByName(String localName) throws BPMNModelException {
NodeList childNodes = this.getElementNode().getChildNodes();
for (int i = 0; i < childNodes.getLength(); i++) {
Node childNode = childNodes.item(i);
if (childNode.getNodeType() == Node.ELEMENT_NODE && childNode.getLocalName().equals(localName)) {
if (childNode != null && childNode.getNodeType() == Node.ELEMENT_NODE
&& childNode.getLocalName().equals(localName)) {
// clear cache
this.childNodes.remove(childNode.getLocalName());
this.getElementNode().removeChild(childNode);
Expand Down

0 comments on commit c770a64

Please sign in to comment.