diff --git a/src/dom/node.c b/src/dom/node.c index 0aaa309c9..4eeabe405 100644 --- a/src/dom/node.c +++ b/src/dom/node.c @@ -295,7 +295,8 @@ get_dom_node_child(struct dom_node *parent, enum dom_node_type type, int index; list = get_dom_node_list_by_type(parent, type); - if (!list) return NULL; + if (!list) return NULL; /* parent doesn't support this type */ + if (!*list) return NULL; /* list is empty and not yet allocated */ foreach_dom_node (*list, node, index) { if (node->type != type)