diff options
author | tradke <tradke@b32723a9-ab3a-4a60-88e2-2e5d99d7c17a> | 2005-07-25 10:23:03 +0000 |
---|---|---|
committer | tradke <tradke@b32723a9-ab3a-4a60-88e2-2e5d99d7c17a> | 2005-07-25 10:23:03 +0000 |
commit | be1248c7eb316e3bc6f91290c1a96dec7fd20fdc (patch) | |
tree | ed26f4aac59c6f7221f0b4922597d8e5b3b1ab5b /src/Utils.c | |
parent | 2be4b4fd1e93eb349bcd51ecb1563f9eab21b741 (diff) |
Check for valid variable index in IOUtil_DefaultIORequest().
git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/IOUtil/trunk@228 b32723a9-ab3a-4a60-88e2-2e5d99d7c17a
Diffstat (limited to 'src/Utils.c')
-rw-r--r-- | src/Utils.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/Utils.c b/src/Utils.c index f18ad1d..38e7e94 100644 --- a/src/Utils.c +++ b/src/Utils.c @@ -1001,12 +1001,20 @@ static void SetOutputVar (int vindex, const char *optstring, void *arg) ioRequest *IOUtil_DefaultIORequest (const cGH *GH, int vindex, int out_every_default) { - ioRequest *request; + int vdim; int *extent_int; + ioRequest *request; const ioGH *myGH; DECLARE_CCTK_PARAMETERS + /* check for valid variable index */ + vdim = CCTK_GroupDimFromVarI (vindex); + if (vdim < 0) + { + return (NULL); + } + myGH = CCTK_GHExtension (GH, "IO"); /* allocate a new I/O request structure */ @@ -1041,7 +1049,7 @@ ioRequest *IOUtil_DefaultIORequest (const cGH *GH, int vindex, } /* get the variable's dimension and extents */ - request->vdim = CCTK_GroupDimFromVarI (vindex); + request->vdim = vdim; extent_int = NULL; if (request->vdim > 0) { |