X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=XMLTree.cpp;h=21658e99c323c4aaaff8b72e385d8580542bddf4;hb=60f0f1a447b2b89ca99589c68333d72bcdeb263d;hp=3c51b2ffb92d1c3808237738382193f918152d2c;hpb=9b3825663e88360c57dfe66cee5330f8f80fb452;p=SXSI%2FXMLTree.git diff --git a/XMLTree.cpp b/XMLTree.cpp index 3c51b2f..21658e9 100644 --- a/XMLTree.cpp +++ b/XMLTree.cpp @@ -311,8 +311,10 @@ treeNode XMLTree::Parent(treeNode x) fprintf(stderr, "Error: data structure has not been constructed properly\n"); exit(1); } - - return parent(Par, x); + if (x == Root()) + return NULLT; + else + return parent(Par, x); } // Child(x,i): returns the i-th child of node x, assuming it exists.