Changeset 38845


Ignore:
Timestamp:
2024-03-14T10:31:00+13:00 (2 months ago)
Author:
kjdon
Message:

check for null parent before getting child nodes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/GSXML.java

    r37613 r38845  
    11181118    public static Element getNamedElement(Element parent, String node_name, String attribute_name, String attribute_value)
    11191119    {
    1120 
    1121         NodeList children = parent.getChildNodes();
     1120        if (parent == null) return null;
     1121        NodeList children = parent.getChildNodes();
    11221122        for (int i = 0; i < children.getLength(); i++)
    11231123        {
     
    11331133            }
    11341134        } // for each child
    1135         // not found
     1135
     1136        // not found
    11361137        return null;
    11371138    }
Note: See TracChangeset for help on using the changeset viewer.