summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO
diff options
context:
space:
mode:
authorScott Mansell <phiren@gmail.com>2015-07-13 12:40:38 +1200
committerScott Mansell <phiren@gmail.com>2015-07-13 12:40:38 +1200
commitdc25277a2f0fb175b865ed1cd87fecc83ae1e5d0 (patch)
treeb16c3fa537a52a6b638eb2b3849f22f0eb716441 /Source/Core/DiscIO
parentb30ae1b9f8a49b0b19e2802ce4f91f6505cd0682 (diff)
parent87e19f1c190719bd1280eb94bcdf372caca5287b (diff)
Merge branch 'stable' into 'master'
Diffstat (limited to 'Source/Core/DiscIO')
-rw-r--r--Source/Core/DiscIO/WbfsBlob.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/Source/Core/DiscIO/WbfsBlob.cpp b/Source/Core/DiscIO/WbfsBlob.cpp
index ef90026621..5c0ac028ea 100644
--- a/Source/Core/DiscIO/WbfsBlob.cpp
+++ b/Source/Core/DiscIO/WbfsBlob.cpp
@@ -115,8 +115,10 @@ bool WbfsFileReader::Read(u64 offset, u64 nbytes, u8* out_ptr)
{
while (nbytes)
{
- u64 read_size = 0;
+ u64 read_size;
File::IOFile& data_file = SeekToCluster(offset, &read_size);
+ if (read_size == 0)
+ return false;
read_size = (read_size > nbytes) ? nbytes : read_size;
if (!data_file.ReadBytes(out_ptr, read_size))
@@ -160,6 +162,8 @@ File::IOFile& WbfsFileReader::SeekToCluster(u64 offset, u64* available)
}
PanicAlert("Read beyond end of disc");
+ if (available)
+ *available = 0;
m_files[0]->file.Seek(0, SEEK_SET);
return m_files[0]->file;
}