In the tree-printing code, we may be handed a leaf node, so don't

require that "fi->tree_type" be positive.

svn path=/trunk/; revision=5084
This commit is contained in:
Guy Harris 2002-04-02 05:07:36 +00:00
parent 590c3c0f8c
commit 5f948e482c
1 changed files with 7 additions and 5 deletions

12
print.c
View File

@ -1,7 +1,7 @@
/* print.c /* print.c
* Routines for printing packet analysis trees. * Routines for printing packet analysis trees.
* *
* $Id: print.c,v 1.44 2002/04/01 02:00:50 guy Exp $ * $Id: print.c,v 1.45 2002/04/02 05:07:36 guy Exp $
* *
* Gilbert Ramirez <gram@alumni.rice.edu> * Gilbert Ramirez <gram@alumni.rice.edu>
* *
@ -197,10 +197,12 @@ void proto_tree_print_node_text(GNode *node, gpointer data)
print_hex_data_text(pdata->fh, pd, fi->length, pdata->encoding); print_hex_data_text(pdata->fh, pd, fi->length, pdata->encoding);
} }
/* If we're printing all levels, or if this level is expanded, /* If we're printing all levels, or if this node is one with a
recurse into the subtree, if it exists. */ subtree and its subtree is expanded, recurse into the subtree,
g_assert(fi->tree_type >= 0 && fi->tree_type < num_tree_types); if it exists. */
if (pdata->print_all_levels || tree_is_expanded[fi->tree_type]) { g_assert(fi->tree_type >= -1 && fi->tree_type < num_tree_types);
if (pdata->print_all_levels ||
(fi->tree_type >= 0 && tree_is_expanded[fi->tree_type])) {
if (g_node_n_children(node) > 0) { if (g_node_n_children(node) > 0) {
pdata->level++; pdata->level++;
g_node_children_foreach(node, G_TRAVERSE_ALL, g_node_children_foreach(node, G_TRAVERSE_ALL,