summaryrefslogtreecommitdiff
path: root/tap-protocolinfo.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2004-10-18 01:18:44 +0000
committerGuy Harris <guy@alum.mit.edu>2004-10-18 01:18:44 +0000
commit19373d6f7edded96b437d4ea1b0cd6931e0ef0ef (patch)
tree9ee69e3b8b645eadf1233633589c19b3fbbd5550 /tap-protocolinfo.c
parent7e1521119f792d256689320289b7926ac32b42c1 (diff)
downloadwireshark-19373d6f7edded96b437d4ea1b0cd6931e0ef0ef.tar.gz
Don't blow up if the proto,colinfo tap is used but the columns aren't
being printed. svn path=/trunk/; revision=12335
Diffstat (limited to 'tap-protocolinfo.c')
-rw-r--r--tap-protocolinfo.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/tap-protocolinfo.c b/tap-protocolinfo.c
index 1e1483caa8..10abe10037 100644
--- a/tap-protocolinfo.c
+++ b/tap-protocolinfo.c
@@ -55,6 +55,20 @@ protocolinfo_packet(void *prs, packet_info *pinfo, epan_dissect_t *edt, void *du
guint i;
char *str;
+ /*
+ * XXX - there needs to be a way for "protocolinfo_init()" to
+ * find out whether the columns are being generated and, if not,
+ * to report an error and exit, as the whole point of this tap
+ * is to modify the columns, and if the columns aren't being
+ * displayed, that makes this tap somewhat pointless.
+ *
+ * To prevent a crash, we check whether pinfo->cinfo is null
+ * and, if so, we report that error and exit.
+ */
+ if (pinfo->cinfo == NULL) {
+ fprintf(stderr, "tethereal: the proto,colinfo tap doesn't work if the columns aren't being printed.\n");
+ exit(1);
+ }
gp=proto_get_finfo_ptr_array(edt->tree, rs->hf_index);
if(!gp){
return 0;