summaryrefslogtreecommitdiff
path: root/src/cxml.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2023-07-02 21:55:47 +0200
committerCarl Hetherington <cth@carlh.net>2023-07-02 21:55:47 +0200
commit3ae8805d65455b093bd698961b89add55055e138 (patch)
tree25212d41aa683ad09f2640e6860ef95ba4e10235 /src/cxml.cc
parentf29b074a156a0186bf3725ec33b2230facd7a870 (diff)
Add check to avoid crash when the API is misused.
Diffstat (limited to 'src/cxml.cc')
-rw-r--r--src/cxml.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/cxml.cc b/src/cxml.cc
index e4435a2..c2d8534 100644
--- a/src/cxml.cc
+++ b/src/cxml.cc
@@ -98,6 +98,10 @@ cxml::Node::node_children (string name) const
how get_path works.
*/
+ if (!_node) {
+ throw cxml::Error("Node has no internal xmlpp node; did you forget to call a read method on cxml::Document?");
+ }
+
vector<shared_ptr<cxml::Node>> n;
for (auto i: _node->get_children()) {
if (i->get_name() == name) {