Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim-plugins.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwurstsalat <mailtrash@posteo.de>2021-02-28 19:17:35 +0300
committerwurstsalat <mailtrash@posteo.de>2021-12-02 23:03:16 +0300
commit45e23b30f09c8e4bccacec96e9db2381fe76e5a5 (patch)
tree6d22e4579d485f008783dcb6062db16d8a77e28e
parente9260fd5fb802d3650f446cd755dcd9ef76e87ef (diff)
[preview] Catch possible error while saving pixbuf
The returned error from save_to_bufferv() is not always reliable, and might be True even if saving succeeded.
-rw-r--r--url_image_preview/utils.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/url_image_preview/utils.py b/url_image_preview/utils.py
index 2cd515f..a8ec495 100644
--- a/url_image_preview/utils.py
+++ b/url_image_preview/utils.py
@@ -150,9 +150,10 @@ def create_thumbnail_with_pixbuf(data, size):
thumbnail = pixbuf.scale_simple(width,
height,
GdkPixbuf.InterpType.BILINEAR)
- has_error, bytes_ = thumbnail.save_to_bufferv('png', [], [])
- if has_error:
- log.warning('saving pixbuf to buffer failed')
+ try:
+ _error, bytes_ = thumbnail.save_to_bufferv('png', [], [])
+ except GLib.Error as err:
+ log.warning('Saving pixbuf to buffer failed: %s', err)
return None
return bytes_