diff options
author | rideout <rideout@0337457d-221f-4ee6-a5f0-14255d5370d8> | 2003-12-27 19:07:08 +0000 |
---|---|---|
committer | rideout <rideout@0337457d-221f-4ee6-a5f0-14255d5370d8> | 2003-12-27 19:07:08 +0000 |
commit | d2b5e05243c5831b2c6c6fb4c59cc27fc853ef46 (patch) | |
tree | 1e09876030cf017b3a660ceff4321370df0bcf97 | |
parent | c02711b0b292abdb319857a53682e536a7e7bf71 (diff) |
Fix seg fault in Coord_SystemHandle().
git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/CoordBase/trunk@6 0337457d-221f-4ee6-a5f0-14255d5370d8
-rw-r--r-- | src/CoordBase.c | 16 |
1 files 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; } /*@@ |