diff options
-rw-r--r-- | src/DumpVar.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/DumpVar.c b/src/DumpVar.c index fdca24a..109df75 100644 --- a/src/DumpVar.c +++ b/src/DumpVar.c @@ -269,7 +269,7 @@ int IOHDF5Util_DumpVar (const cGH *GH, @returntype int @returndesc - always 0 + 0 for success, or -1 if file handle is invalid @endreturndesc @@*/ static int IOHDF5Util_DumpGS (const cGH *GH, @@ -288,6 +288,12 @@ static int IOHDF5Util_DumpGS (const cGH *GH, static CCTK_INT global_shape[1] = {0}; + /* immediately return if file handle is invalid */ + if (file < 0) + { + return (-1); + } + /* Get the handles for IOHDF5Util and IOUtil extensions */ ioUtilGH = (ioGH *) CCTK_GHExtension (GH, "IO"); myGH = (ioHDF5UtilGH *) CCTK_GHExtension (GH, "IOHDF5Util"); @@ -723,6 +729,12 @@ static void IOHDF5Util_procDump (const cGH *GH, DECLARE_CCTK_PARAMETERS + /* immediately return if file handle is invalid */ + if (file < 0) + { + return; + } + ioUtilGH = (ioGH *) CCTK_GHExtension (GH, "IO"); myGH = (ioHDF5UtilGH *) CCTK_GHExtension (GH, "IOHDF5Util"); @@ -959,6 +971,12 @@ static void IOHDF5Util_collectiveDump (const cGH *GH, DECLARE_CCTK_PARAMETERS + /* immediately return if file handle is invalid */ + if (file < 0) + { + return; + } + myGH = (ioHDF5UtilGH *) CCTK_GHExtension (GH, "IOHDF5Util"); /* get the dimension of the variable */ |