diff options
-rw-r--r-- | src/lib_io.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/lib_io.c b/src/lib_io.c index 7c06b78e..b9d8cc75 100644 --- a/src/lib_io.c +++ b/src/lib_io.c | |||
@@ -284,8 +284,14 @@ static int io_file_lines(lua_State *L) | |||
284 | 284 | ||
285 | LJLIB_CF(io_method_close) | 285 | LJLIB_CF(io_method_close) |
286 | { | 286 | { |
287 | IOFileUD *iof = L->base < L->top ? io_tofile(L) : | 287 | IOFileUD *iof; |
288 | io_stdfile(L, GCROOT_IO_OUTPUT); | 288 | if (L->base < L->top) { |
289 | iof = io_tofile(L); | ||
290 | } else { | ||
291 | iof = IOSTDF_IOF(L, GCROOT_IO_OUTPUT); | ||
292 | if (iof->fp == NULL) | ||
293 | lj_err_caller(L, LJ_ERR_IOCLFL); | ||
294 | } | ||
289 | return io_file_close(L, iof); | 295 | return io_file_close(L, iof); |
290 | } | 296 | } |
291 | 297 | ||