]> git.mxchange.org Git - simgear.git/commitdiff
The handle gets nulled out if the user has closed the file; don't pass that
authorandy <andy>
Thu, 16 Mar 2006 18:01:56 +0000 (18:01 +0000)
committerandy <andy>
Thu, 16 Mar 2006 18:01:56 +0000 (18:01 +0000)
null to fclose() in a garbage collection destructor too...

simgear/nasal/iolib.c

index f6b5db0c242fd6b789820a4be007a5fb1dae4607..b9c81f33a0cc186f2fde0af1b37bf39dc4975d96 100644 (file)
@@ -79,7 +79,8 @@ static void ghostDestroy(void* g)
 
 static void ioclose(naContext c, void* f)
 {
-    if(fclose(f) != 0 && c) naRuntimeError(c, strerror(errno));
+    if(f)
+        if(fclose(f) != 0 && c) naRuntimeError(c, strerror(errno));
 }
 
 static int ioread(naContext c, void* f, char* buf, unsigned int len)