Fix invalid check for fread error on extracting zip
authorsapier <Sapier at GMX dot net>
Fri, 7 Feb 2014 20:29:31 +0000 (21:29 +0100)
committersapier <Sapier at GMX dot net>
Fri, 7 Feb 2014 20:29:31 +0000 (21:29 +0100)
src/script/lua_api/l_mainmenu.cpp

index ef16efde2a6a32100ade6080227e0ac8cff1b6cb..1a28c9ba098a8381d7a104c1ebf709029fe6b2e7 100644 (file)
@@ -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);