aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschnetter <schnetter@6a38eb6e-646e-4a02-a296-d141613ad6c4>2004-03-05 19:50:55 +0000
committerschnetter <schnetter@6a38eb6e-646e-4a02-a296-d141613ad6c4>2004-03-05 19:50:55 +0000
commitfb956d2266d98ee45de1199be01815aabcb16db2 (patch)
tree835a164eacdb1e702d568010a2d37551d7fb3726
parente87c37cd7f03c0b6202cf2ae89324ca8873ca495 (diff)
Check arguments, and return with an error code if there is an error.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/Boundary/trunk@260 6a38eb6e-646e-4a02-a296-d141613ad6c4
-rw-r--r--src/Boundary.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/Boundary.c b/src/Boundary.c
index 4e0c0e3..d9da8a3 100644
--- a/src/Boundary.c
+++ b/src/Boundary.c
@@ -386,6 +386,7 @@ CCTK_INT Bdry_Boundary_SelectVarForBC(CCTK_POINTER_TO_CONST _GH,
-2 no such physical boundary condition registered
-3 faces already selected for bc
-5 new value for GH passed in
+ -7 invalid variable index
@endreturndesc
@@*/
CCTK_INT Bdry_Boundary_SelectVarForBCI(CCTK_POINTER_TO_CONST _GH,
@@ -409,6 +410,14 @@ CCTK_INT Bdry_Boundary_SelectVarForBCI(CCTK_POINTER_TO_CONST _GH,
previous = NULL;
previous_bcdata = NULL;
+ if (var_index<0 || var_index>=CCTK_NumVars())
+ {
+ CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "Invalid variable index");
+ retval = -7;
+ return retval;
+ }
+
#ifdef DEBUG
printf("Boundary_SelectVarForBCI:\n");
printf(" called with GH=%p, faces=%d, width=%d, table_handle=%d, "
@@ -801,6 +810,7 @@ CCTK_INT Bdry_Boundary_SelectGroupForBCI(CCTK_POINTER_TO_CONST _GH,
CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING,
"Invalid group index");
retval = -7;
+ return retval;
}
#ifdef DEBUG