summaryrefslogtreecommitdiff
path: root/ext/dom/attr.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/dom/attr.c')
-rw-r--r--ext/dom/attr.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/ext/dom/attr.c b/ext/dom/attr.c
index 057d0d5..5929d88 100644
--- a/ext/dom/attr.c
+++ b/ext/dom/attr.c
@@ -92,6 +92,12 @@ int dom_attr_name_read(dom_object *obj, zval **retval TSRMLS_DC)
xmlAttrPtr attrp;
attrp = (xmlAttrPtr) dom_object_get_node(obj);
+
+ if (attrp == NULL) {
+ php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
+ return FAILURE;
+ }
+
ALLOC_ZVAL(*retval);
ZVAL_STRING(*retval, (char *) (attrp->name), 1);
@@ -131,6 +137,11 @@ int dom_attr_value_read(dom_object *obj, zval **retval TSRMLS_DC)
attrp = (xmlAttrPtr) dom_object_get_node(obj);
+ if (attrp == NULL) {
+ php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
+ return FAILURE;
+ }
+
ALLOC_ZVAL(*retval);
@@ -152,6 +163,11 @@ int dom_attr_value_write(dom_object *obj, zval *newval TSRMLS_DC)
attrp = (xmlAttrPtr) dom_object_get_node(obj);
+ if (attrp == NULL) {
+ php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
+ return FAILURE;
+ }
+
if (attrp->children) {
node_list_unlink(attrp->children TSRMLS_CC);
}
@@ -190,6 +206,11 @@ int dom_attr_owner_element_read(dom_object *obj, zval **retval TSRMLS_DC)
nodep = dom_object_get_node(obj);
+ if (nodep == NULL) {
+ php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
+ return FAILURE;
+ }
+
nodeparent = nodep->parent;
if (!nodeparent) {
return FAILURE;