Fix NULL-pointer crash in handoff_init(...)

Change-Id: If403f83b4e918e81e7b2e90dfca14960ad2c6aa6
Signed-off-by: Dave Barach <dave@barachs.net>
This commit is contained in:
Dave Barach
2016-06-13 18:16:27 -04:00
parent 0247b46002
commit 5a9c9b8bb5

View File

@ -513,11 +513,14 @@ clib_error_t *handoff_init (vlib_main_t *vm)
vlib_thread_registration_t * tr;
/* Only the standard vnet worker threads are supported */
p = hash_get_mem (tm->thread_registrations_by_name, "workers");
tr = (vlib_thread_registration_t *) p[0];
if (tr)
if (p)
{
hm->num_workers = tr->count;
hm->first_worker_index = tr->first_index;
tr = (vlib_thread_registration_t *) p[0];
if (tr)
{
hm->num_workers = tr->count;
hm->first_worker_index = tr->first_index;
}
}
hm->vlib_main = vm;