summaryrefslogtreecommitdiffstats
path: root/gtk/src/hb-backend.c
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2014-07-30 18:54:46 +0000
committerjstebbins <[email protected]>2014-07-30 18:54:46 +0000
commitaa2e5b996b327930687ae8985c779c4a55770ea3 (patch)
tree240001294fa8b5be02f549e063215bd99689d400 /gtk/src/hb-backend.c
parent87197ca0eba8e17328594a21dc0ba67cd0728435 (diff)
LinGui: protect against failure to get preview image
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6245 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk/src/hb-backend.c')
-rw-r--r--gtk/src/hb-backend.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c
index 175d523cc..e6302cdda 100644
--- a/gtk/src/hb-backend.c
+++ b/gtk/src/hb-backend.c
@@ -5046,14 +5046,21 @@ ghb_get_preview_image(
uiGeo.par.num = 1;
uiGeo.par.den = 1;
+ GdkPixbuf *preview;
hb_image_t *image;
image = hb_get_preview2(h_scan, title->index, index, &uiGeo, deinterlace);
+ if (image == NULL)
+ {
+ preview = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8,
+ title->width, title->height);
+ return preview;
+ }
+
// Create an GdkPixbuf and copy the libhb image into it, converting it from
// libhb's format something suitable.
// The image data returned by hb_get_preview is 4 bytes per pixel,
// BGRA format. Alpha is ignored.
- GdkPixbuf *preview;
preview = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8,
image->width, image->height);
guint8 *pixels = gdk_pixbuf_get_pixels(preview);