[evince] comics: Don't throw errors in a loop if image is not readable



commit 3e438b9dbc3f1458e486f7940bf9cad1143f154a
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Jul 11 13:41:09 2017 +0200

    comics: Don't throw errors in a loop if image is not readable
    
    If the file inside the comics archive isn't a readable image file, then
    the loader would get closed but we'd keep trying to feed it data,
    leading to tons of warnings.
    
    Exit early with the gdk-pixbuf loader error instead.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=784790

 backend/comics/comics-document.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/backend/comics/comics-document.c b/backend/comics/comics-document.c
index 5e07df4..ee06009 100644
--- a/backend/comics/comics-document.c
+++ b/backend/comics/comics-document.c
@@ -321,7 +321,10 @@ comics_document_get_page_size (EvDocument *document,
 
                        read = ev_archive_read_data (comics_document->archive, buf, sizeof(buf), &error);
                        while (read > 0 && !info.got_info) {
-                               gdk_pixbuf_loader_write (loader, (guchar *) buf, read, NULL);
+                               if (!gdk_pixbuf_loader_write (loader, (guchar *) buf, read, &error)) {
+                                       read = -1;
+                                       break;
+                               }
                                read = ev_archive_read_data (comics_document->archive, buf, BLOCK_SIZE, 
&error);
                        }
                        if (read < 0) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]