Commit 990d23b7 authored by Daniel Brötzmann's avatar Daniel Brötzmann

[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.
parent ae33767f
......@@ -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_
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment