From e577852eb45da4b3fa402023fae99760007343fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Capello?= Date: Tue, 4 Apr 2023 16:33:49 -0300 Subject: [PATCH] Improve message error when loading a sequence of png files whose color modes don't match (fix #3751) --- src/app/file/file.cpp | 4 +++- src/app/file/png_format.cpp | 4 +--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/file/file.cpp b/src/app/file/file.cpp index afcdfee99..8f9da324c 100644 --- a/src/app/file/file.cpp +++ b/src/app/file/file.cpp @@ -1309,8 +1309,10 @@ ImageRef FileOp::sequenceImage(PixelFormat pixelFormat, int w, int h) else { sprite = m_document->sprite(); - if (sprite->pixelFormat() != pixelFormat) + if (sprite->pixelFormat() != pixelFormat) { + setError("Error: image does not match color mode\n"); return nullptr; + } } if (m_seq.last_cel) { diff --git a/src/app/file/png_format.cpp b/src/app/file/png_format.cpp index 923d09a26..578c1484a 100644 --- a/src/app/file/png_format.cpp +++ b/src/app/file/png_format.cpp @@ -279,10 +279,8 @@ bool PngFormat::onLoad(FileOp* fop) int imageWidth = png_get_image_width(png, info); int imageHeight = png_get_image_height(png, info); ImageRef image = fop->sequenceImage(pixelFormat, imageWidth, imageHeight); - if (!image) { - fop->setError("file_sequence_image %dx%d\n", imageWidth, imageHeight); + if (!image) return false; - } // Transparent color png_color_16p png_trans_color = NULL;