ECC-1781: Further cleanup

This commit is contained in:
shahramn 2024-03-06 10:25:42 +00:00
parent f6d1bb67cb
commit d0f68666e6
2 changed files with 3 additions and 2 deletions

View File

@ -214,7 +214,7 @@ static int find_global(grib_nearest* nearest, grib_handle* h,
return ret; return ret;
} }
while (grib_iterator_next(iter, &lat, &lon, NULL)) { while (grib_iterator_next(iter, &lat, &lon, NULL)) {
if (olat != lat) { if (ilat < self->lats_count && olat != lat) {
self->lats[ilat++] = lat; self->lats[ilat++] = lat;
olat = lat; olat = lat;
} }

View File

@ -251,7 +251,7 @@ static int find_global(grib_nearest* nearest, grib_handle* h,
return err; return err;
} }
while (grib_iterator_next(iter, &lat, &lon, NULL)) { while (grib_iterator_next(iter, &lat, &lon, NULL)) {
if (olat != lat) { if (ilat < self->lats_count && olat != lat) {
self->lats[ilat++] = lat; self->lats[ilat++] = lat;
olat = lat; olat = lat;
} }
@ -262,6 +262,7 @@ static int find_global(grib_nearest* nearest, grib_handle* h,
if (lon > 180 && lon < 360) if (lon > 180 && lon < 360)
lon -= 360; lon -= 360;
} }
DEBUG_ASSERT_ACCESS(self->lons, (long)ilon, (long)nearest->values_count);
self->lons[ilon++] = lon; self->lons[ilon++] = lon;
} }
self->lats_count = ilat; self->lats_count = ilat;