Commit dab34672 authored by Kjell Ahlstedt's avatar Kjell Ahlstedt

Node: Move the null-pointer check to the constructor.

* libxml++/nodes/node.[h|cc]: Let the constructor throw xmlpp:internal_error
if impl_ == 0. Remove other null-pointer checks. Bug #705187.
parent 74c29b4d
......@@ -119,7 +119,10 @@ namespace xmlpp
Node::Node(xmlNode* node)
: impl_(node)
{
impl_->_private = this;
if (!impl_)
throw internal_error("xmlNode pointer cannot be 0");
impl_->_private = this;
}
Node::~Node()
......@@ -510,9 +513,6 @@ Glib::ustring Node::eval_to_string(const Glib::ustring& xpath, const PrefixNsMap
Glib::ustring Node::get_namespace_prefix() const
{
if(!impl_)
return Glib::ustring();
if(impl_->type == XML_DOCUMENT_NODE || impl_->type == XML_ENTITY_DECL)
{
//impl_ is actually of type xmlDoc or xmlEntity, instead of just xmlNode.
......@@ -538,9 +538,6 @@ Glib::ustring Node::get_namespace_prefix() const
Glib::ustring Node::get_namespace_uri() const
{
if(!impl_)
return Glib::ustring();
if(impl_->type == XML_DOCUMENT_NODE ||
impl_->type == XML_ENTITY_DECL ||
impl_->type == XML_ATTRIBUTE_DECL)
......
......@@ -55,6 +55,8 @@ class Node : public NonCopyable
public:
typedef std::list<Node*> NodeList;
/** @throws xmlpp::internal_error If @a node is <tt>0</tt>.
*/
explicit Node(_xmlNode* node);
virtual ~Node();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment