diff options
author | Guy Harris <guy@alum.mit.edu> | 2014-12-08 17:30:04 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2014-12-09 01:30:41 +0000 |
commit | 3d95c623a8e5126d389bf3de0abfb02cb7354015 (patch) | |
tree | c737909fddea927e87dae7e65e107126eccdd34e /wiretap | |
parent | f34bcb79475c830a41fa89ee32cb38715d1fa08d (diff) |
Don't try to look in a non-existent hash table.
We only create hash tables if somebody puts a handler in one, so we need
to check whether the hash table exists first, to avoid run-time warnings.
Change-Id: I739d2d808935e651b11bd44b258f168a42ca4b7c
Reviewed-on: https://code.wireshark.org/review/5683
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wiretap')
-rw-r--r-- | wiretap/pcapng.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/wiretap/pcapng.c b/wiretap/pcapng.c index 04a46202f4..abbc0c4c93 100644 --- a/wiretap/pcapng.c +++ b/wiretap/pcapng.c @@ -1414,9 +1414,9 @@ pcapng_read_packet_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t *pn, wta /* * Do we have a handler for this packet block option code? */ - handler = (option_handler)g_hash_table_lookup(option_handlers[BT_INDEX_PBS], - GUINT_TO_POINTER((guint)oh->option_code)); - if (handler != NULL) { + if (option_handlers[BT_INDEX_PBS] != NULL && + (handler = (option_handler)g_hash_table_lookup(option_handlers[BT_INDEX_PBS], + GUINT_TO_POINTER((guint)oh->option_code))) != NULL) { /* Yes - call the handler. */ if (!handler(pn->byte_swapped, oh->option_length, option_content, err, err_info)) |