Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix invalid check for fread error on extracting zip
  • Loading branch information
sapier authored and sapier committed Feb 7, 2014
1 parent 6715c42 commit 3670f5a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/script/lua_api/l_mainmenu.cpp
Expand Up @@ -864,9 +864,8 @@ int ModApiMainMenu::l_extract_zip(lua_State *L)

unsigned int bytes_read =
toread->read(read_buffer,sizeof(read_buffer));
unsigned int bytes_written;
if ((bytes_read < 0 ) ||
(bytes_written = fwrite(read_buffer, 1, bytes_read, targetfile) != bytes_read))
if ((bytes_read == 0 ) ||
(fwrite(read_buffer, 1, bytes_read, targetfile) != bytes_read))
{
fclose(targetfile);
fs->removeFileArchive(fs->getFileArchiveCount()-1);
Expand Down

0 comments on commit 3670f5a

Please sign in to comment.