summaryrefslogtreecommitdiff
path: root/src/core/document.c
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2012-08-06 11:26:23 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2012-08-06 11:26:23 +0100
commit464fe3793d4bba82ff3fe859b81c0dd42d54544c (patch)
tree96116d2dba595c7093dae4ec4012439fe0532fe8 /src/core/document.c
parentba2d58bb356c9ac16bcac8f02ff4d1c6882f86c8 (diff)
downloadlibdom-464fe3793d4bba82ff3fe859b81c0dd42d54544c.tar.gz
libdom-464fe3793d4bba82ff3fe859b81c0dd42d54544c.tar.bz2
DOMDocument::_dom_find_element_by_id: Only compare ids, if the element *has* one
Diffstat (limited to 'src/core/document.c')
-rw-r--r--src/core/document.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/core/document.c b/src/core/document.c
index 456d906..6284897 100644
--- a/src/core/document.c
+++ b/src/core/document.c
@@ -1233,14 +1233,15 @@ dom_exception _dom_find_element_by_id(dom_node_internal *root,
dom_string *real_id;
_dom_element_get_id((dom_element *) node, &real_id);
+ if (real_id != NULL) {
+ if (dom_string_isequal(real_id, id)) {
+ dom_string_unref(real_id);
+ *result = (dom_element *) node;
+ return DOM_NO_ERR;
+ }
- if (dom_string_isequal(real_id, id)) {
dom_string_unref(real_id);
- *result = (dom_element *) node;
- return DOM_NO_ERR;
}
-
- dom_string_unref(real_id);
}
if (node->first_child != NULL) {