From 3ae8805d65455b093bd698961b89add55055e138 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 2 Jul 2023 21:55:47 +0200 Subject: Add check to avoid crash when the API is misused. --- src/cxml.cc | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') 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> n; for (auto i: _node->get_children()) { if (i->get_name() == name) { -- cgit v1.2.3