[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:
@@ -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_
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user