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...
This commit is contained in:
andy 2006-03-16 18:01:56 +00:00
parent 7d631e4959
commit 33e01e431d

View File

@ -79,7 +79,8 @@ static void ghostDestroy(void* g)
static void ioclose(naContext c, void* f) 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) static int ioread(naContext c, void* f, char* buf, unsigned int len)