Ethereal-dev: Re: [Ethereal-dev] Just as an asside...

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Guy Harris <gharris@xxxxxxxxxxxx>
Date: Thu, 7 Dec 2000 00:28:56 -0800
On Thu, Dec 07, 2000 at 07:17:03PM +1100, C. L. McAvaney wrote:
> ...does it matter if you call a proto_tree_add...  function if there
> is no tree?

All the "proto_tree_add" routines should just return NULL and not try to
add anything to the non-existent protocol tree if handed a null "tree"
argument.  If there are some that don't, that's a bug.

Note that if your dissector creates subtrees, it'd have to do something
such as

	ti = proto_tree_add_whatever(tree, ...);
	if (ti != NULL)
		subtree = proto_item_add_subtree(ti, ett_subtree);
	else
		subtree = NULL;