diff options
Diffstat (limited to 'libs/pbd/xml++.cc')
-rw-r--r-- | libs/pbd/xml++.cc | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/libs/pbd/xml++.cc b/libs/pbd/xml++.cc index 23ecfabc91..c18d36f065 100644 --- a/libs/pbd/xml++.cc +++ b/libs/pbd/xml++.cc @@ -466,10 +466,16 @@ std::string XMLNode::attribute_value() { XMLNodeList children = this->children(); - assert(!_is_content); - assert(children.size() == 1); + if (_is_content) + throw XMLException("XMLNode: attribute_value failed (is_content) for requested node: " + name()); + + if (children.size() != 1) + throw XMLException("XMLNode: attribute_value failed (children.size != 1) for requested node: " + name()); + XMLNode* child = *(children.begin()); - assert(child->is_content()); + if (!child->is_content()) + throw XMLException("XMLNode: attribute_value failed (!child->is_content()) for requested node: " + name()); + return child->content(); } |