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 76d3ace1..35c57d8b 100644 --- a/src/lib_io.c +++ b/src/lib_io.c | |||
| @@ -293,8 +293,14 @@ static int io_file_lines(lua_State *L) | |||
| 293 | 293 | ||
| 294 | LJLIB_CF(io_method_close) | 294 | LJLIB_CF(io_method_close) |
| 295 | { | 295 | { |
| 296 | IOFileUD *iof = L->base < L->top ? io_tofile(L) : | 296 | IOFileUD *iof; |
| 297 | io_stdfile(L, GCROOT_IO_OUTPUT); | 297 | if (L->base < L->top) { |
| 298 | iof = io_tofile(L); | ||
| 299 | } else { | ||
| 300 | iof = IOSTDF_IOF(L, GCROOT_IO_OUTPUT); | ||
| 301 | if (iof->fp == NULL) | ||
| 302 | lj_err_caller(L, LJ_ERR_IOCLFL); | ||
| 303 | } | ||
| 298 | return io_file_close(L, iof); | 304 | return io_file_close(L, iof); |
| 299 | } | 305 | } |
| 300 | 306 | ||
