summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/imfile/imfile.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/plugins/imfile/imfile.c b/plugins/imfile/imfile.c
index b3b2f060..ba09ea42 100644
--- a/plugins/imfile/imfile.c
+++ b/plugins/imfile/imfile.c
@@ -332,11 +332,15 @@ BEGINafterRun
int i;
CODESTARTafterRun
/* Close files and persist file state information. We do NOT abort on error iRet as that makes
- * matters worse (at least we can try persisting the others...).
+ * matters worse (at least we can try persisting the others...). Please note that, under stress
+ * conditions, it may happen that we are terminated before we actuall could open all streams. So
+ * before we change anything, we need to make sure the stream was open.
*/
for(i = 0 ; i < iFilPtr ; ++i) {
- persistStrmState(&files[i]);
- strmDestruct(&(files[i].pStrm));
+ if(files[i].pStrm != NULL) { /* stream open? */
+ persistStrmState(&files[i]);
+ strmDestruct(&(files[i].pStrm));
+ }
}
ENDafterRun