summaryrefslogtreecommitdiff
path: root/drivers/png/image_loader_png.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/png/image_loader_png.cpp')
-rw-r--r--drivers/png/image_loader_png.cpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/png/image_loader_png.cpp b/drivers/png/image_loader_png.cpp
index 04acb9387e..a4ea889d3b 100644
--- a/drivers/png/image_loader_png.cpp
+++ b/drivers/png/image_loader_png.cpp
@@ -227,10 +227,7 @@ static void user_read_data(png_structp png_ptr, png_bytep data, png_size_t p_len
PNGReadStatus *rstatus;
rstatus = (PNGReadStatus *)png_get_io_ptr(png_ptr);
- png_size_t to_read = p_length;
- if (rstatus->size >= 0) {
- to_read = MIN(p_length, rstatus->size - rstatus->offset);
- }
+ png_size_t to_read = MIN(p_length, rstatus->size - rstatus->offset);
memcpy(data, &rstatus->image[rstatus->offset], to_read);
rstatus->offset += to_read;