From: andy Date: Thu, 16 Mar 2006 18:01:56 +0000 (+0000) Subject: The handle gets nulled out if the user has closed the file; don't pass that X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=33e01e431db75c07c5d30d3b881b8827bc13b16c;p=simgear.git 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... --- 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)