From f4ba4e071f0cf20f65232cff6af941069482742d Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Wed, 30 Aug 2023 10:36:48 +0000 Subject: [PATCH] ECC-1674: Treatment of constant fields --- src/grib_accessor_class_data_run_length_packing.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/grib_accessor_class_data_run_length_packing.cc b/src/grib_accessor_class_data_run_length_packing.cc index 3fa8f44c6..61e581185 100644 --- a/src/grib_accessor_class_data_run_length_packing.cc +++ b/src/grib_accessor_class_data_run_length_packing.cc @@ -279,6 +279,12 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len) cclass_name, n_vals, number_of_values); return GRIB_ENCODING_ERROR; } + + if (bits_per_value == 0) { + // TODO(masn): What are we meant to do with constant fields? + return GRIB_SUCCESS; + } + level_values = (long*)grib_context_malloc_clear(a->context, sizeof(long) * number_of_level_values); level_values_size = number_of_level_values; if ((err = grib_get_long_array_internal(gh, self->level_values, level_values, &level_values_size)) != GRIB_SUCCESS)