Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

Update tiio_png.cpp

JPUser15e8feabdc364
diff --git a/toonz/sources/image/png/tiio_png.cpp b/toonz/sources/image/png/tiio_png.cpp
index dcfd6c02e..490c2f424 100644
--- a/toonz/sources/image/png/tiio_png.cpp
+++ b/toonz/sources/image/png/tiio_png.cpp
@@ -268,16 +268,26 @@ public:
if (m_tempBuffer && m_y == ly) {
m_tempBuffer.reset();
}
+ throw TException("Unable to read file");
return;
}
int y = m_info.m_ly - 1 - m_y;
- if (y < 0) return;
+ if (y < 0) {
+ throw TException("Unable to read file");
+ return;
+ }
m_y++;
png_bytep row_pointer = m_rowBuffer.get();
png_read_row(m_png_ptr, row_pointer, NULL);
+ if (setjmp(png_jmpbuf(m_png_ptr))) {
+ // If an error is caught in the next line, execution jumps here.
+ // We'll keep going in order ot load whever we can read.
+ return;
+ }
+
writeRow(buffer, x0, x1);
if (m_tempBuffer && m_y == ly) {