diff options
-rw-r--r-- | src/GetSymmetry.c | 7 | ||||
-rw-r--r-- | src/SetSymmetry.c | 7 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/GetSymmetry.c b/src/GetSymmetry.c index f21a3ee..5224a96 100644 --- a/src/GetSymmetry.c +++ b/src/GetSymmetry.c @@ -57,6 +57,13 @@ int GetCartSymVI(const cGH *GH, int *sym, int vi) DECLARE_CCTK_PARAMETERS + if (vi < 0 || vi >= CCTK_NumVars ()) + { + CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING, + "Invalid variable index %d in GetCartSymVI", vi); + return(-1); + } + /* Pointer to the SymmetryGHextension */ sGHex = (SymmetryGHex *)CCTK_GHExtension(GH, "Symmetry"); diff --git a/src/SetSymmetry.c b/src/SetSymmetry.c index 263af8d..c0742fc 100644 --- a/src/SetSymmetry.c +++ b/src/SetSymmetry.c @@ -59,6 +59,13 @@ int SetCartSymVI (const cGH *GH, const int *sym, int vi) DECLARE_CCTK_PARAMETERS + if (vi < 0 || vi >= CCTK_NumVars ()) + { + CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING, + "Invalid variable index %d in SetCartSymVI", vi); + return(-1); + } + /* Pointer to the SymmetryGHextension */ sGHex = (SymmetryGHex *) CCTK_GHExtension (GH, "Symmetry"); |