BUFR: protection against descriptors being NULL
@@ -2878,6 +2878,10 @@ static int process_elements(grib_accessor* a, int flag, long onlySubset, long st
return err;
descriptors = self->expanded->v;
+ if (!descriptors) {
+ grib_context_log(c, GRIB_LOG_ERROR, "No descriptors found!");
+ return GRIB_INTERNAL_ERROR;
+ }
if (do_clean == 1 && self->numericValues) {
grib_vdarray_delete_content(c, self->numericValues);
@@ -2953,8 +2957,8 @@ static int process_elements(grib_accessor* a, int flag, long onlySubset, long st
numberOfNestedRepetitions = 0;
for (i = 0; i < numberOfDescriptors; i++) {
- if (c->debug && descriptors)
- grib_context_log(c, GRIB_LOG_DEBUG, "BUFR data processing: elementNumber=%ld code=%6.6ld", icount++, descriptors[i]->code);
+ if (c->debug) grib_context_log(c, GRIB_LOG_DEBUG, "BUFR data processing: elementNumber=%ld code=%6.6ld",
+ icount++, descriptors[i]->code);
switch (descriptors[i]->F) {
case 0:
/* Table B element */
