From 40a09476494cac4d9beb25c335d3d29db26bb196 Mon Sep 17 00:00:00 2001 From: Pavel Krajcevski Date: Sun, 27 Jan 2013 14:02:39 -0500 Subject: [PATCH] Fix small bug where we enter an infinite loop after we finish reading a file. --- IO/src/ImageFile.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IO/src/ImageFile.cpp b/IO/src/ImageFile.cpp index bbb0576..bb9e852 100644 --- a/IO/src/ImageFile.cpp +++ b/IO/src/ImageFile.cpp @@ -204,7 +204,7 @@ unsigned char *ImageFile::ReadFileData(const CHAR *filename) { uint64 totalBytesLeft = fileSize; uint32 bytesToRead = uint32(std::min(totalBytesLeft, uint64(1 << 31))); int32 bytesRead; - while((bytesRead = fstr.Read(rawData, uint32(fileSize))) >= 0) { + while((bytesRead = fstr.Read(rawData, uint32(fileSize))) > 0) { totalBytesRead += bytesRead; totalBytesLeft -= bytesRead; }