Skip to content

Commit

Permalink
Fix when properties return nullptr (#52)
Browse files Browse the repository at this point in the history
It seems that there should be a better way to
get properties not to be nullptr
  • Loading branch information
huanghantao authored Dec 26, 2020
1 parent 9888199 commit 2b30d69
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/dbgp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,19 @@ void Dbgp::get_zend_object_child_property_doc(tinyxml2::XMLElement *child, const
zend_ulong num;
zend_string *key;
zval *val;

// TODO(codinghuang): it seems that properties will be nullptr
properties = yasd::Util::get_properties(property_element.value);
int level = property_element.level;

child->SetAttribute("type", "object");
child->SetAttribute("classname", ZSTR_VAL(class_name));
child->SetAttribute("children", properties->nNumOfElements > 0 ? "1" : "0");
child->SetAttribute("numchildren", properties->nNumOfElements);
child->SetAttribute("children", (properties && properties->nNumOfElements > 0) ? "1" : "0");
child->SetAttribute("numchildren", properties ? properties->nNumOfElements : 0);

if (UNEXPECTED(!properties)) {
return;
}

std::vector<yasd::ZendPropertyInfo> summary_properties_info;

Expand Down

0 comments on commit 2b30d69

Please sign in to comment.