Shortcut a read outside the file.

This happened to me.
This commit is contained in:
Unknown W. Brackets 2014-11-25 09:16:17 -08:00
parent 99b422aa0a
commit 53e6d49568

View File

@ -312,6 +312,10 @@ void HTTPFileLoader::Seek(s64 absolutePos) {
size_t HTTPFileLoader::ReadAt(s64 absolutePos, size_t bytes, void *data) {
s64 absoluteEnd = std::min(absolutePos + (s64)bytes, filesize_);
if (absolutePos >= filesize_ || bytes == 0) {
// Read outside of the file or no read at all, just fail immediately.
return 0;
}
// TODO: Keepalive, etc.
client_.Connect();