From 065081717a219b52a2a2df3f4463da1408fb8300 Mon Sep 17 00:00:00 2001 From: tradke Date: Wed, 4 Sep 2002 08:20:34 +0000 Subject: Check that the variable to get a hyperslab from has storage assigned. git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGH/PUGHSlab/trunk@91 10716dce-81a3-4424-a2c8-48026a0d3035 --- src/GetHyperslab.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src') 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)); -- cgit v1.2.3