From: kim Date: Tue, 27 Jan 2009 00:04:58 +0000 (+0000) Subject: NextSibling() segfault when called on the root node, so add a check X-Git-Url: http://git.nguyen.vg/gitweb/?a=commitdiff_plain;h=9b3825663e88360c57dfe66cee5330f8f80fb452;p=SXSI%2FXMLTree.git NextSibling() segfault when called on the root node, so add a check and retrung NULLT if the argument is ther root node. It's consistent with the behaviour of calling FirstChild on a leaf node. git-svn-id: svn+ssh://idea.nguyen.vg/svn/sxsi/trunk/XMLTree@65 3cdefd35-fc62-479d-8e8d-bae585ffb9ca --- diff --git a/XMLTree.cpp b/XMLTree.cpp index 92360a4..3c51b2f 100644 --- a/XMLTree.cpp +++ b/XMLTree.cpp @@ -345,7 +345,9 @@ treeNode XMLTree::NextSibling(treeNode x) fprintf(stderr, "Error: data structure has not been constructed properly\n"); exit(1); } - + if (x == Root()) + return NULLT; + return next_sibling(Par, x); }