If "proto_item_set_len()" is passed a null pointer as its first
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 7 May 2001 21:06:59 +0000 (21:06 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 7 May 2001 21:06:59 +0000 (21:06 +0000)
argument, have it just return; this allows dissectors that don't
explicitly check for a null protocol-tree argument to pass the
protocol-tree argument to "proto_tree_add_XXX()" routines - which means
they'll get a null pointer back if the protocol-tree argument is null
because we're not constructing a protocol tree - and then later use
"proto_item_set_len()" without having to check for a null
protocol-tree-item pointer.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@3402 f5534014-38df-0310-8fa8-9805f1628bb7

epan/proto.c

index e6fbab60ac90f6069d4dd92f2f0a43dd038eb6cd..d025736be42ed6057e95725edaa3c7555a9ac61c 100644 (file)
@@ -1,7 +1,7 @@
 /* proto.c
  * Routines for protocol tree
  *
- * $Id: proto.c,v 1.25 2001/04/23 01:19:39 guy Exp $
+ * $Id: proto.c,v 1.26 2001/05/07 21:06:59 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -1524,7 +1524,11 @@ proto_item_set_text(proto_item *pi, const char *format, ...)
 void
 proto_item_set_len(proto_item *pi, gint length)
 {
-       field_info *fi = (field_info*) (((GNode*)pi)->data);
+       field_info *fi;
+       
+       if (pi == NULL)
+               return;
+       fi = (field_info*) (((GNode*)pi)->data);
        fi->length = length;
 }