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)