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>
This commit is contained in:
Guy Harris 2014-12-08 17:30:04 -08:00
parent f34bcb7947
commit 3d95c623a8
1 changed files with 3 additions and 3 deletions

View File

@ -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))