From af49ffb2b148e146feada9dea59342508414f122 Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Thu, 1 Oct 2020 20:52:31 +0100 Subject: html: Check for missing thead rather than dereffing a NULL Signed-off-by: Daniel Silverstone --- src/html/html_tablerow_element.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/html/html_tablerow_element.c b/src/html/html_tablerow_element.c index fe7d929..569e70f 100644 --- a/src/html/html_tablerow_element.c +++ b/src/html/html_tablerow_element.c @@ -244,16 +244,17 @@ dom_exception dom_html_table_row_element_get_row_index( return exp; } - exp = dom_html_table_section_element_get_rows(t_head, &rows); - dom_node_unref(t_head); - if (exp != DOM_NO_ERR) { - return exp; - } - - dom_html_collection_get_length(rows, &len); - dom_html_collection_unref(rows); + if (t_head != NULL) { + exp = dom_html_table_section_element_get_rows(t_head, &rows); + dom_node_unref(t_head); + if (exp != DOM_NO_ERR) { + return exp; + } - count += len; + dom_html_collection_get_length(rows, &len); + dom_html_collection_unref(rows); + count += len; + } for (n = n->first_child;n != parent && n != NULL; n = n->next) { -- cgit v1.2.3