Merge pull request #313 from valeriyvan/nulldereference

Fixing possible null pointer dereference
This commit is contained in:
Arseny Kapoulkine 2019-12-03 21:17:28 -08:00 committed by GitHub
commit 2e8631d2eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6264,6 +6264,7 @@ namespace pugi
return found.parent().first_element_by_path(next_segment, delimiter); return found.parent().first_element_by_path(next_segment, delimiter);
else else
{ {
if (found._root) {
for (xml_node_struct* j = found._root->first_child; j; j = j->next_sibling) for (xml_node_struct* j = found._root->first_child; j; j = j->next_sibling)
{ {
if (j->name && impl::strequalrange(j->name, path_segment, static_cast<size_t>(path_segment_end - path_segment))) if (j->name && impl::strequalrange(j->name, path_segment, static_cast<size_t>(path_segment_end - path_segment)))
@ -6272,6 +6273,7 @@ namespace pugi
if (subsearch) return subsearch; if (subsearch) return subsearch;
} }
}
} }
return xml_node(); return xml_node();