diff options
author | Vincent Sanders <vince@kyllikki.org> | 2015-10-20 22:36:42 +0100 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2015-10-20 22:36:42 +0100 |
commit | 37ea372a100f6a1a47afc47ce9430ed6e2b4c44b (patch) | |
tree | bc4973b1b848f545e4e59b2254c097f2ab6bdcce /javascript/duktape/Node.bnd | |
parent | 6d0d964cac44ede2b6defa4d9330f51d22b30689 (diff) | |
download | netsurf-37ea372a100f6a1a47afc47ce9430ed6e2b4c44b.tar.gz netsurf-37ea372a100f6a1a47afc47ce9430ed6e2b4c44b.tar.bz2 |
allow for libdom node calls which return NULL to indicate no node.
Diffstat (limited to 'javascript/duktape/Node.bnd')
-rw-r--r-- | javascript/duktape/Node.bnd | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/javascript/duktape/Node.bnd b/javascript/duktape/Node.bnd index 0b1bfe390..3a723ddfb 100644 --- a/javascript/duktape/Node.bnd +++ b/javascript/duktape/Node.bnd @@ -132,7 +132,9 @@ getter Node::firstChild() dom_exception exc; dom_node *n; exc = dom_node_get_first_child(priv->node, &n); - if (exc != DOM_NO_ERR) return 0; + if ((exc != DOM_NO_ERR) || (n == NULL)) { + return 0; + } if (dukky_push_node(ctx, n) == false) { dom_node_unref(n); return 0; @@ -146,7 +148,9 @@ getter Node::lastChild() dom_exception exc; dom_node *n; exc = dom_node_get_last_child(priv->node, &n); - if (exc != DOM_NO_ERR) return 0; + if ((exc != DOM_NO_ERR) || (n == NULL)) { + return 0; + } if (dukky_push_node(ctx, n) == false) { dom_node_unref(n); return 0; @@ -160,7 +164,9 @@ getter Node::previousSibling() dom_exception exc; dom_node *n; exc = dom_node_get_previous_sibling(priv->node, &n); - if (exc != DOM_NO_ERR) return 0; + if ((exc != DOM_NO_ERR) || (n == NULL)) { + return 0; + } if (dukky_push_node(ctx, n) == false) { dom_node_unref(n); return 0; @@ -174,7 +180,9 @@ getter Node::nextSibling() dom_exception exc; dom_node *n; exc = dom_node_get_next_sibling(priv->node, &n); - if (exc != DOM_NO_ERR) return 0; + if ((exc != DOM_NO_ERR) || (n == NULL)) { + return 0; + } if (dukky_push_node(ctx, n) == false) { dom_node_unref(n); return 0; |