From 19373d6f7edded96b437d4ea1b0cd6931e0ef0ef Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Mon, 18 Oct 2004 01:18:44 +0000 Subject: Don't blow up if the proto,colinfo tap is used but the columns aren't being printed. svn path=/trunk/; revision=12335 --- tap-protocolinfo.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'tap-protocolinfo.c') 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; -- cgit v1.2.1