SkStream::read() only returns 0 at end.
All implementations behave this way, so respect it.
BUG=skia:2936
Review URL: https://codereview.chromium.org/888703002
diff --git a/src/images/SkImageDecoder_libwebp.cpp b/src/images/SkImageDecoder_libwebp.cpp
index 5ac647a..d2061db 100644
--- a/src/images/SkImageDecoder_libwebp.cpp
+++ b/src/images/SkImageDecoder_libwebp.cpp
@@ -59,10 +59,8 @@
unsigned char* dst = buffer + totalBytesRead;
const size_t bytesRead = stream->read(dst, bytesToRead);
if (0 == bytesRead) {
- // Could not read any bytes. Check to see if we are at the end (exit
- // condition), and continue reading if not. Important for streams
- // that do not have all the data ready.
- continue;
+ SkASSERT(stream->isAtEnd());
+ break;
}
bytesToRead -= bytesRead;
totalBytesRead += bytesRead;