ECC-424: Do not allow non-BUFR messages for bufr_keys_iterator_new

This commit is contained in:
Shahram Najm 2017-02-06 13:45:34 +00:00
parent dc422ec54c
commit 91fb3f14d7
2 changed files with 12 additions and 0 deletions

View File

@ -16,6 +16,12 @@ bufr_keys_iterator* codes_bufr_keys_iterator_new(grib_handle* h)
if (!h) return NULL;
if (h->product_kind != PRODUCT_BUFR) {
grib_context_log(h->context, GRIB_LOG_ERROR,
"Invalid keys iterator for message: please use codes_keys_iterator_new");
return NULL;
}
ki= (bufr_keys_iterator*)grib_context_malloc_clear(h->context,sizeof(bufr_keys_iterator));
if (!ki) return NULL;

View File

@ -23,6 +23,12 @@ grib_keys_iterator* grib_keys_iterator_new(grib_handle* h,unsigned long filter_f
if (!h) return NULL;
/*if (h->product_kind == PRODUCT_BUFR) {
grib_context_log(h->context, GRIB_LOG_ERROR,
"Invalid keys iterator for BUFR message: please use codes_bufr_keys_iterator_new");
return NULL;
}*/
ki= (grib_keys_iterator*)grib_context_malloc_clear(h->context,sizeof(grib_keys_iterator));
if (!ki) return NULL;