Blob Blame History Raw
From 935cde46aeed5b4865a0494017f7415f46da4a09 Mon Sep 17 00:00:00 2001
From: Michael Webster <miketwebster@gmail.com>
Date: Mon, 9 Jan 2017 15:13:41 -0500
Subject: [PATCH 3/4] framedImage.py:  Just silently fail if a downloaded image
 fails to be loaded into a pixbuf.

see: https://bugzilla.redhat.com/show_bug.cgi?id=1399731
---
 src/widgets/framedImage.py | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/widgets/framedImage.py b/src/widgets/framedImage.py
index ca9010b..433dc04 100644
--- a/src/widgets/framedImage.py
+++ b/src/widgets/framedImage.py
@@ -67,8 +67,11 @@ class FramedImage(Gtk.Image):
         self.set_size_request(-1, self.get_theme_height())
 
         if self.path:
-            pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(self.path, -1, self.get_theme_height(), True)
-            self.set_from_pixbuf(pixbuf)
+            try:
+                pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(self.path, -1, self.get_theme_height(), True)
+                self.set_from_pixbuf(pixbuf)
+            except:
+                self.clear_image()
             self.emit("pixbuf-changed", pixbuf)
 
         elif self.file:
@@ -100,8 +103,11 @@ class FramedImage(Gtk.Image):
     def on_file_written(self, file, result, data=None):
         try:
             if file.replace_contents_finish(result):
-                pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(file.get_path(), -1, self.get_theme_height(), True)
-                self.set_from_pixbuf(pixbuf)
+                try:
+                    pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(file.get_path(), -1, self.get_theme_height(), True)
+                    self.set_from_pixbuf(pixbuf)
+                except:
+                    self.clear_image()
                 self.emit("pixbuf-changed", pixbuf)
         except GLib.Error:
             pass
\ No newline at end of file
-- 
2.9.3