Merge pull request #2383 from dnc40085/dev_file.read()_retval_fix

Fix for lack of nil return in file.read() when EOF is reached
This commit is contained in:
Terry Ellison 2018-05-27 10:52:25 +01:00 committed by GitHub
commit 994e8faa2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -432,7 +432,8 @@ static int file_g_read( lua_State* L, int n, int16_t end_char, int fd )
luaM_free(L, heap_mem); luaM_free(L, heap_mem);
heap_mem = NULL; heap_mem = NULL;
} }
return 0; lua_pushnil(L);
return 1;
} }
vfs_lseek(fd, -(n - i), VFS_SEEK_CUR); vfs_lseek(fd, -(n - i), VFS_SEEK_CUR);