projects
/
SXSI
/
XMLTree.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
NextSibling() segfault when called on the root node, so add a check
[SXSI/XMLTree.git]
/
XMLTree.cpp
diff --git
a/XMLTree.cpp
b/XMLTree.cpp
index
92360a4
..
3c51b2f
100644
(file)
--- 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");
\r
exit(1);
\r
}
\r
fprintf(stderr, "Error: data structure has not been constructed properly\n");
\r
exit(1);
\r
}
\r
-
\r
+ if (x == Root())
\r
+ return NULLT;
\r
+
\r
return next_sibling(Par, x);
\r
}
\r
\r
return next_sibling(Par, x);
\r
}
\r
\r