From be1248c7eb316e3bc6f91290c1a96dec7fd20fdc Mon Sep 17 00:00:00 2001 From: tradke Date: Mon, 25 Jul 2005 10:23:03 +0000 Subject: 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 --- src/Utils.c | 12 ++++++++++-- 1 file 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) { -- cgit v1.2.3