yajl_val *array = YAJL_GET_ARRAY(br_ports)->values;
size_t array_len = YAJL_GET_ARRAY(br_ports)->len;
if (array != NULL && array_len > 0 && YAJL_IS_ARRAY(array[1])) {
- yajl_val *ports_arr = YAJL_GET_ARRAY(array[1])->values;
- size_t ports_num = YAJL_GET_ARRAY(array[1])->len;
- for (size_t i = 0; i < ports_num && ports_arr != NULL; i++) {
- tmp = YAJL_GET_STRING(ports_arr[i]->u.array.values[1]);
- if (tmp != NULL)
- ovs_stats_new_port(br, tmp);
- else
- goto failure;
+ if (YAJL_GET_ARRAY(array[1]) == NULL)
+ goto failure;
+ else {
+ yajl_val *ports_arr = YAJL_GET_ARRAY(array[1])->values;
+ size_t ports_num = YAJL_GET_ARRAY(array[1])->len;
+ for (size_t i = 0; i < ports_num && ports_arr != NULL; i++) {
+ tmp = YAJL_GET_STRING(ports_arr[i]->u.array.values[1]);
+ if (tmp != NULL)
+ ovs_stats_new_port(br, tmp);
+ else
+ goto failure;
+ }
}
}
} else