Commit 867a50af authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

cdf_define_all_grids: check xdimid and ydimid before access ncdims[].

parent 3601e654
......@@ -2724,8 +2724,8 @@ int cdf_define_all_grids(ncgrid_t *ncgrid, int vlistID, ncdim_t *ncdims, int nva
const int gridindex = vlistGridIndex(vlistID, gridID);
ncgrid[gridindex].gridID = gridID;
ncgrid[gridindex].ncIDs[CDF_DIMID_X] = ncdims[xdimid].dimid;
ncgrid[gridindex].ncIDs[CDF_DIMID_Y] = ncdims[ydimid].dimid;
if (xdimid != CDI_UNDEFID) ncgrid[gridindex].ncIDs[CDF_DIMID_X] = ncdims[xdimid].dimid;
if (ydimid != CDI_UNDEFID) ncgrid[gridindex].ncIDs[CDF_DIMID_Y] = ncdims[ydimid].dimid;
if ( grid->type == GRID_TRAJECTORY )
{
ncgrid[gridindex].ncIDs[CDF_VARID_X] = xvarid;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment