diff options
author | Guy Harris <guy@alum.mit.edu> | 2016-06-21 11:21:33 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2016-06-21 18:21:42 +0000 |
commit | 6cc90dde536beb28671a4537f93f85d67a66a0ff (patch) | |
tree | b623ded381dd74325a0509ec235bd9e275c1ba03 /epan/packet.c | |
parent | d970da40255807ab13d84f865c1b9de124f00c3a (diff) |
As with dissector_add_uint(), so with dissector_add_{string,guid}.
Improve the error message for a null disssector handle.
Fix indentation while we're at it.
Change-Id: I1cb2f8ac52e56fc98f6b3ad981018f571e5a7bf0
Reviewed-on: https://code.wireshark.org/review/16060
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/packet.c')
-rw-r--r-- | epan/packet.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/epan/packet.c b/epan/packet.c index 95d6665e16..3573a982df 100644 --- a/epan/packet.c +++ b/epan/packet.c @@ -1303,8 +1303,15 @@ dissector_add_string(const char *name, const gchar *pattern, char *key; /* - * Make sure the dissector table exists. + * Make sure the handle and the dissector table exist. */ + if (handle == NULL) { + fprintf(stderr, "OOPS: handle to register \"%s\" to doesn't exist\n", + name); + if (getenv("WIRESHARK_ABORT_ON_DISSECTOR_BUG") != NULL) + abort(); + return; + } if (sub_dissectors == NULL) { fprintf(stderr, "OOPS: dissector table \"%s\" doesn't exist\n", name); @@ -1315,8 +1322,6 @@ dissector_add_string(const char *name, const gchar *pattern, return; } - /* sanity checks */ - g_assert(handle!=NULL); switch (sub_dissectors->type) { case FT_STRING: @@ -1600,8 +1605,15 @@ void dissector_add_guid(const char *name, guid_key* guid_val, dissector_handle_t sub_dissectors = find_dissector_table(name); /* - * Make sure the dissector table exists. + * Make sure the handle and the dissector table exist. */ + if (handle == NULL) { + fprintf(stderr, "OOPS: handle to register \"%s\" to doesn't exist\n", + name); + if (getenv("WIRESHARK_ABORT_ON_DISSECTOR_BUG") != NULL) + abort(); + return; + } if (sub_dissectors == NULL) { fprintf(stderr, "OOPS: dissector table \"%s\" doesn't exist\n", name); @@ -1612,9 +1624,7 @@ void dissector_add_guid(const char *name, guid_key* guid_val, dissector_handle_t return; } - /* sanity checks */ - g_assert(handle!=NULL); - if (sub_dissectors->type != FT_GUID) { + if (sub_dissectors->type != FT_GUID) { g_assert_not_reached(); } |