[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.
This commit is contained in:
wurstsalat
2021-02-28 17:17:35 +01:00
parent ae33767fe1
commit 990d23b714

View File

@@ -150,9 +150,10 @@ def create_thumbnail_with_pixbuf(data, size):
thumbnail = pixbuf.scale_simple(width, thumbnail = pixbuf.scale_simple(width,
height, height,
GdkPixbuf.InterpType.BILINEAR) GdkPixbuf.InterpType.BILINEAR)
has_error, bytes_ = thumbnail.save_to_bufferv('png', [], []) try:
if has_error: _error, bytes_ = thumbnail.save_to_bufferv('png', [], [])
log.warning('saving pixbuf to buffer failed') except GLib.Error as err:
log.warning('Saving pixbuf to buffer failed: %s', err)
return None return None
return bytes_ return bytes_