Skip to content

Commit

Permalink
Merge branch 'master' into v2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Pall committed Jul 22, 2021
2 parents bff9298 + d87da3d commit dbb6c39
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/lib_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,14 @@ static int io_file_lines(lua_State *L)

LJLIB_CF(io_method_close)
{
IOFileUD *iof = L->base < L->top ? io_tofile(L) :
io_stdfile(L, GCROOT_IO_OUTPUT);
IOFileUD *iof;
if (L->base < L->top) {
iof = io_tofile(L);
} else {
iof = IOSTDF_IOF(L, GCROOT_IO_OUTPUT);
if (iof->fp == NULL)
lj_err_caller(L, LJ_ERR_IOCLFL);
}
return io_file_close(L, iof);
}

Expand Down

0 comments on commit dbb6c39

Please sign in to comment.