From d2b5e05243c5831b2c6c6fb4c59cc27fc853ef46 Mon Sep 17 00:00:00 2001 From: rideout Date: Sat, 27 Dec 2003 19:07:08 +0000 Subject: Fix seg fault in Coord_SystemHandle(). git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/CoordBase/trunk@6 0337457d-221f-4ee6-a5f0-14255d5370d8 --- src/CoordBase.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/CoordBase.c b/src/CoordBase.c index 82122d9..eb3c777 100644 --- a/src/CoordBase.c +++ b/src/CoordBase.c @@ -211,7 +211,7 @@ CCTK_INT Coord_SystemRegister(CCTK_POINTER_TO_CONST GH, CCTK_INT dim, CCTK_INT Coord_SystemHandle(CCTK_POINTER_TO_CONST GH, CCTK_STRING systemname) { - int *handle_ptr; + int *handle_ptr, retval; const coordbaseGH *GHex; uHash *hash; @@ -223,14 +223,20 @@ CCTK_INT Coord_SystemHandle(CCTK_POINTER_TO_CONST GH, CCTK_STRING systemname) handle_ptr = Util_HashData(hash, strlen(systemname), systemname, 0); if (!handle_ptr) { - *handle_ptr = COORDERROR_NOSYSTEM; + retval = COORDERROR_NOSYSTEM; } - else if (*handle_ptr<0) + else { - *handle_ptr = COORDERROR_TABLEERROR; + if (*handle_ptr<0) + { + retval = COORDERROR_TABLEERROR; + } else + { + retval = *handle_ptr; + } } - return *handle_ptr; + return retval; } /*@@ -- cgit v1.2.3