From 226318aa3b0b982ca01301734442977f12b8ec55 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sat, 26 Sep 2020 16:05:47 -0500 Subject: [PATCH] Update: check if stream exists before attempting to close stream. --- level_0/f_file/c/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/level_0/f_file/c/file.c b/level_0/f_file/c/file.c index 076a59a..b72d0f0 100644 --- a/level_0/f_file/c/file.c +++ b/level_0/f_file/c/file.c @@ -1875,7 +1875,7 @@ extern "C" { if (!file) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (!fclose(file->stream)) { + if (file->stream && !fclose(file->stream)) { if (errno == EACCES) return F_status_set_error(F_access_denied); if (errno == EAGAIN) return F_status_set_error(F_prohibited); if (errno == EBADF) return F_status_set_error(F_file_descriptor); -- 1.8.3.1