diff options
Diffstat (limited to 'src/GetHyperslab.c')
-rw-r--r-- | src/GetHyperslab.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/GetHyperslab.c b/src/GetHyperslab.c index d8becdc..5af25b6 100644 --- a/src/GetHyperslab.c +++ b/src/GetHyperslab.c @@ -68,7 +68,7 @@ CCTK_INT Hyperslab_Get (const cGH *GH, CCTK_INT retval; retval = Hyperslab_GetList (GH, mapping_handle, 1, &proc, &vindex, - &timelevel, + &timelevel, hdatatype<0?NULL:&hdatatype, &hdata, NULL); return (retval == 1 ? 0 : -1); @@ -382,6 +382,14 @@ static int GetLocalHyperslab (const cGH *GH, errormsg = "Group data for template variable in mapping and given variable " "don't match"; } + else + { + vdata = CCTK_VarDataPtrI (GH, timelevel, vindex); + if (vdata == NULL) + { + errormsg = "Variable has no storage allocated"; + } + } /* immediately return in case of errors */ if (errormsg) @@ -443,8 +451,6 @@ static int GetLocalHyperslab (const cGH *GH, /* nested loop over vinfo.dim dimensions */ /* NOTE: the following code assumes startpoint[vdim] < endpoint[vdim] */ - vdata = CCTK_VarDataPtrI (GH, timelevel, vindex); - if (mapping->is_full_hyperslab && conversion_fn == NULL) { memcpy (hdata, vdata, mapping->totals * CCTK_VarTypeSize (vinfo.vartype)); |