2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

vfs: Handle failure of file reading within VfsRawCopy()

Also gets rid of an unused variable.
This commit is contained in:
Lioncash 2018-10-24 00:01:29 -04:00
parent c6529688fc
commit c7c594a6b8
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -472,12 +472,16 @@ bool VfsRawCopy(const VirtualFile& src, const VirtualFile& dest, std::size_t blo
std::vector<u8> temp(std::min(block_size, src->GetSize()));
for (std::size_t i = 0; i < src->GetSize(); i += block_size) {
const auto read = std::min(block_size, src->GetSize() - i);
const auto block = src->Read(temp.data(), read, i);
if (dest->Write(temp.data(), read, i) != read)
if (src->Read(temp.data(), read, i) != read) {
return false;
}
if (dest->Write(temp.data(), read, i) != read) {
return false;
}
}
return true;
}