From 33e01e431db75c07c5d30d3b881b8827bc13b16c Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 16 Mar 2006 18:01:56 +0000 Subject: [PATCH] The handle gets nulled out if the user has closed the file; don't pass that null to fclose() in a garbage collection destructor too... --- simgear/nasal/iolib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/simgear/nasal/iolib.c b/simgear/nasal/iolib.c index f6b5db0c..b9c81f33 100644 --- a/simgear/nasal/iolib.c +++ b/simgear/nasal/iolib.c @@ -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)