aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortradke <tradke@10716dce-81a3-4424-a2c8-48026a0d3035>2002-09-04 08:20:34 +0000
committertradke <tradke@10716dce-81a3-4424-a2c8-48026a0d3035>2002-09-04 08:20:34 +0000
commit065081717a219b52a2a2df3f4463da1408fb8300 (patch)
tree5987d94ca86f54ff2a6eaedc4cb7f41859980105 /src
parented77535d3e7bd2617127d0ada3b60a031c2c7ed5 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/GetHyperslab.c12
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));